Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-06

Problem found and solved

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Shane Miller

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 06/30 2:50 AM >>>
Shane Miller wrote 9 lines
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 with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Shane Miller

I'm trying to look this up in the manual. Where in the manual is it?

Shane

>> Michael Van Canneyt 06/30 2:50 AM >>>
Shane Miller wrote 9 lines
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 with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email