[lazarus] Problem found and solved

Shane Miller SMiller1 at stvgb.org
Wed Jun 30 10:11:02 EDT 1999


I get an error when I type that in.  I get...
Fatal: Syntaz Error, : expected but ; found.
It seems to be expecting a semi-colon at the end but it's declared as a Procedure....

Shane


>>> Michael Van Canneyt <michael.vancanneyt at wisa.be> 06/30 2:50 AM >>>


On Tue, 29 Jun 1999, Shane Miller wrote:

> Could someone please pull the source from CVS and take a look at this
> problem and see if you can find a way to make this work?  I'm having
> trouble with it.  2 things you need to do after pulling the latest version:
> 
> Uncomment (if it's commented out yet) the AssignOwnEvents method in the
> TMemo.Create procedure in stdcontrols.pp and in editor.pp go to the
> Memo1Change procedure and tell it to writeln(Caption) or something
> so you can see that when you try to access anything throuigh "SELF"
> that it throws an exception.  

The solution is documented in the new manuals. We now support the
following construct:

Procedure TMyObject.MyCallback (Var Var1: Type1;Self : TMyObject); message 'changed'; cdecl;

begin
  // This will load self from the second parameter.
end;

So you declare your callback function with the correct number of arguments,
(so it matches the gtk_signal_func) and then you do a

gtk_signal_connect(gtk_object(fcomponent),'changed',gtk_signal_func(MyCallback),Self)

Self will be passed through the 'self' argument.

This was implemented especially for GTK and QT; see the docs for more info.

If it isn't clear, just ask.

Michael.


_________________________________________________________________
     To unsubscribe: mail lazarus-request at miraclec.com with
                "unsubscribe" as the Subject
    archives at http://www.miraclec.com/list_archives/lazarus






More information about the Lazarus mailing list