Re: learning gtk - callbacks
greg wolski [EMAIL PROTECTED] wrote: Subject: learning gtk - callbacks Hi there, I am trying to learn gtk and I have a hard time to understand signals. This comes from helloworld in tutorial g_signal_connect (G_OBJECT (window), delete_event, G_CALLBACK (delete_event), NULL); g_signal_connect (G_OBJECT (window), destroy, G_CALLBACK (destroy), NULL); Question: How does gtk know what functions it should call? I mean for me it basically says: call this or this. Is it about the arguments that are declared in callback functions? This is a little bit confusing because no arguments are indicated in those connections. Thanks for any help, For learning purposes, I humbly suggest Euphoria/GTK. Euphoria is an extremely fast interpreted language, and it, along with the GTK bindings, make creating GTK programs amazingly simple compared to C. There are no makefiles, compiling or linking to do, you just write code and run it. Once you have a better understanding of how GTK works, you will have less trouble writing your programs in C, if you find it necessary. Here are links to documentation, sample code, screenshots, etc: http://databrook.com/users/irvm/ the project itself is hosted at http://sourceforge.net/projects/eugtk Regards, Irv ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: learning gtk - callbacks
On Fri, 2004-09-24 at 16:30 -0700, greg wolski wrote: Hi there, I am trying to learn gtk and I have a hard time to understand signals. This comes from helloworld in tutorial g_signal_connect (G_OBJECT (window), delete_event, G_CALLBACK (delete_event), NULL); g_signal_connect (G_OBJECT (window), destroy, G_CALLBACK (destroy), NULL); Question: How does gtk know what functions it should call? The third argument to g_signal_connect defines which function GTK calls. In your examples G_CALLBACK (delete_event) and G_CALLBACK (destroy) are the third arguments. The G_CALLBACK () is to cast the function pointer to the correct type, the actual functions are called delete_event and destroy, which happens to be the same as the signal names, this is just coincidence you can call them anything you want. I mean for me it basically says: call this or this. Is it about the arguments that are declared in callback functions? No, it is about the functions you pass as the third argument to g_signal_connect. This is a little bit confusing because no arguments are indicated in those connections. The fourth argument to g_signal_connect is a pointer you can use to pass an extra argument to the callback function. The signatures for callback functions depend on the signal type and the object type. These signatures are defined in the API documents. The convention is that the final argument to a callback is a gpointer data which will be the pointer you supply as the fourth argument to g_signal_connect. In your example this is NULL in both cases. Keith. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
learning gtk - callbacks
Hi there, I am trying to learn gtk and I have a hard time to understand signals. This comes from helloworld in tutorial g_signal_connect (G_OBJECT (window), delete_event, G_CALLBACK (delete_event), NULL); g_signal_connect (G_OBJECT (window), destroy, G_CALLBACK (destroy), NULL); Question: How does gtk know what functions it should call? I mean for me it basically says: call this or this. Is it about the arguments that are declared in callback functions? This is a little bit confusing because no arguments are indicated in those connections. Thanks for any help, ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: learning gtk - callbacks
greg wolski wrote: Hi there, I am trying to learn gtk and I have a hard time to understand signals. This comes from helloworld in tutorial g_signal_connect (G_OBJECT (window), delete_event, G_CALLBACK (delete_event), NULL); g_signal_connect (G_OBJECT (window), destroy, G_CALLBACK (destroy), NULL); Question: How does gtk know what functions it should call? I mean for me it basically says: call this or this. Is it about the arguments that are declared in callback functions? This is a little bit confusing because no arguments are indicated in those connections. Thanks for any help, The best way to learn is to google for gobject. A lot of detail on gobject is here: http://www.le-hacker.org/papers/gobject/ There's also previous posts on the gtk lists on tutorials being written. There's also: http://www.gtk.org/tutorial/ It will take a long time to get the hang of it, but it's much easier after you do. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list