Assigning event from delphi
I would like assing b.OnClick event from this sample code below, but not from script. So my question is: is it possible translate b.OnClick := @ButtonClick to delphi. Is there a way how to find a pointer to the 'ButtonClick' procedure from script and assign this pointer, something like
Thanks
Martin
var
m : TNotifyEvent;
begin
TMethod(m).Code := ?? How To Find ('ButtonClick') ??
TMethod(m).Data := B;
TButton( B ).OnClick:=m;
sample script (b is pointer to existing button component)
procedure ButtonClick(Sender: TButton);
begin
ShowMessage(Sender.Name);
end;
begin
b.OnClick := @ButtonClick;
end.
Thanks
Martin