On 15/07/2014 19:56, rupert THURNER wrote:
type
TForm1 = class(TForm)
procedure SpeedButton1Click(Sender: TObject);
procedure TForm1.SpeedButton1Click(Sender: TObject);
procedure TForm1.CreateButton(t: Integer;l: Integer;btext: String; machine:
String);
var
button: TSpeedButton;
begin
button:=TSpeedButton.Create(self);
button.OnClick:=SpeedButton1Click(button);
There are two errors.
button should be a field in the TForm1 class. Declared as a local
variable it will be inaccessible after CreateButton() exits.
If using {$mode objfpc} the OnCick assignment should be
button.OnClick:=@SpeedButton1Click;
with no parameter specified. In delphi mode you don't need the "@" operator.
Howard
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal