Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9224015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:12:45+00:00 2026-06-18T04:12:45+00:00

I have a TMachine class, that is a TShape class unit MachineShape; interface uses

  • 0

I have a TMachine class, that is a TShape class

unit MachineShape;


interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, extctrls,myDataModule,Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type

TMachine = class(TShape)
  private
    { Private declarations }
  public
    { Public declarations }
    procedure PlaceShape(sizeW,sizeH :integer; name, order,asset : string);
  end;
implementation



    Procedure TMachine.PlaceShape(sizeW,sizeH :integer; name, order,asset : string);
    begin
       self.width :=  sizeW;
       self.height := sizeH;
       self.top := 136;
       self.left := MyDataModule.fDB.LastX +2;//set left
       MyDataModule.fDB.lastx := left + sizeW;
    end;



end.

How would i add onmouseenter code for this? So when the shape is added during run time it will have its own on mouse enter code. Something like this, I know this wont work.. but maybe it will show you what i am looking to do? So when i create a TMachine, i would pass the name and number to this procedure and it would make the onmouseenter procedure update with the name/number i sent it.

Procedure TMachine.EditMouseEnter(name,number :string);
begin
   ....onmouseenter(Label2.Caption := name AND label3.caption := Number)...
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:12:46+00:00Added an answer on June 18, 2026 at 4:12 am

    Add an OnMouseEnter event:

    type
      TMachineEvent = procedure(Sender: TMachine) of object;
    
      TMachine = class(TShape)
      private
        FOnMouseEnter: TMachineEvent;
        ...
        procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
      protected
        procedure DoMouseEnter; virtual;
      published
        property OnMouseEnter: TMachineEvent read FOnMouseEnter write FOnMouseEnter;
        ...
      end;
    
    implementation
    
    { TMachine }
    
    procedure TMachine.CMMouseenter(var Message: TMessage);
    begin
      DoMouseEnter;
      inherited;
    end;
    
    procedure TMachine.DoMouseEnter;
    begin
      if Assigned(FOnMouseEnter) then
        FOnMouseEnter(Self);
    end;
    

    And assign that event at runtime:

    procedure TForm1.CreateMachine;
    var
      Machine: TMachine;
    begin
      Machine := TMachine.Create(Self);
      Machine.SetBounds(...);
      Machine.OnMouseEnter := MachineMouseEnter;
      Machine.Parent := Self;
    end;
    
    procedure TForm1.MachineMouseEnter(Sender: TMachine);
    begin
      Label2.Caption := Sender.Name;
      Label3.Caption := Sender.Number;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a news story display, similar to HackerNews, that uses an <ol> tag for
Have an app that can use tts to read text messages. It can also
have written this little class, which generates a UUID every time an object of
have 2 questions : A computer with 32-bit address uses 2-level page table (9
Have a chat room, issue is, is that when you submit something, the message
have defined a Java Interface with the annotation @WebService Compiled the code which went
Have a photography site that I want to prevent image copying from. How can
Have written all the code in a silverlight class library (dll) and linked this
Have a problem that seems easy on paper but i'm having a big problem
have a class structure like so Permit -> Financial ->ICollection instrumentList Instrument -> Agency

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.