Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating a Runtime onClick method with Delphi .net?

10 views
Skip to first unread message

Nigel Scott

unread,
Apr 5, 2006, 5:45:49 PM4/5/06
to
Could you suggest code to create a runtime onclick method for a Framework
environment or point me to some existing code?

With Delphi (7), one would write the following

aButton := TButton.Create(self);
aButton.Parent := Self;
aButton.Name := 'OK';
aButton.onClick := DoSomethingUseful;
...
...

procedure TForm1.DoSomethingUseful(Sender: TObject)
begin
....
end;

Using Delphi for .Net, I can create a variable number of buttons, but need
to assign a common onClick method for each instantiation.

Using D2006.

Nigel Scott, MVS

Unknown

unread,
Apr 5, 2006, 6:27:15 PM4/5/06
to
On Wed, 5 Apr 2006 15:45:49 -0600, Nigel Scott wrote:

> Using D2006.

I assume you mean Winforms since the above code should work in
VCL.NET:

aButton := Button.Create;
aButton.Parent := Self;
aButton.Text := 'OK';
Include(aButton.onClick, DoSomethingUseful);

--
Marc Rohloff [TeamB]
marc rohloff -at- myrealbox -dot- com

0 new messages