[fpc-pascal]About callbacks method of a class
memsom at interalpha.co.uk
memsom at interalpha.co.uk
Wed Nov 13 17:06:24 CET 2002
Now that's much nicer :-)
> Right, procedures and methods (= procedures of object) are not compatible.
> You have to write your own mapper. For example:
>
> type
> TButton = class
> procedure OnClickCallback(Widget: PGtkWidget);
> end;
>
> procedure TButton.OnClickCallback(Widget: PGtkWidget);
> begin
>
> end;
>
> procedure Callback_TButton_OnClick(widget:PGtkWidget; data:Object); cdecl;
> begin
> TButton(Data).OnClickCallback(Widget);
> end;
>
> begin
> g_signal_connect(G_OBJECT(FButton),'clicked',
> TGCALLBACK(@Callback_TButton_OnClick),FButton);
> end.
---------------------------------------------
This message was sent using Mistral WebMail.
http://www.mistral.co.uk/
More information about the fpc-pascal
mailing list