Home > Back-end >  Dynamically generated SpeedButton component methods and events
Dynamically generated SpeedButton component methods and events

Time:10-28

Now I need to be dynamically generated dynamically generated SpeedButton components, and to write the generated SpeedButton component events (Click), so please give me some help, write a instance, thank you!

CodePudding user response:

 private 
Procedure SpeedButton1Click (Sender: TObject);
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation

{$R *. DFM}

Procedure TForm1. FormCreate (Sender: TObject);
Var BTN: TspeedButton;
The begin
With TspeedButton. Create (self) to do
The begin
Caption:='click';
Width:=60;
Height:=30;
Name:='btn1';
Parent:=the Self;
Left:=100;
Top:=100;
: OnClick=SpeedButton1Click;
end;

end;

Procedure TForm1. SpeedButton1Click (Sender: TObject);
The begin
ShowMessage (TSpeedButton (the sender). The Name + 'click! ');
end;

CodePudding user response:

Same as above,,,,,,,,

CodePudding user response:

That if it has already been into an external program, how behind the external application of the existing SpeedButton, add a? And respond to the click

CodePudding user response:

SpeedButton behind to compute position, had better be specified,

CodePudding user response:

Correct answer on the ground floor

CodePudding user response:

Last week, I do a software, so it is, most of the interface are automatically generated, mainly control the generated location,

CodePudding user response:

If you really need to dynamically generate event code
Such as floor said what can set some event code, and then is equal to the event,
But if you want to dynamically generated code, need for JAVA SCRIPT or other

CodePudding user response:

refer to 6th floor oushengfen response:
for a while, before I do a software, so it is, most of the interface are automatically generated, and the location of the main control the generated,
-- -- -- -- -- -- -- -- -- whether can share the code, has been looking forward to, thank you.
  • Related