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
> 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