Re: Callbacks and widgets



Hi Gonzalo,

I don't do that for *every* widget, just for logical groups.
In my GUI application I do this for the window, the toolbar, the statusbar, the content area (a notebook) and for each content page. Likewise I subclass dialogs.

Stefan

Gonzalo Aguilar Delgado wrote:
Hi, stefan.

This looks also good but it's a pain to have to instanciate every
widget. But for some special widgets may be a great solution...

Thank you for your reply.



hi,
Gonzalo Aguilar Delgado wrote:

Yep, I know about some of them:

        1.- Passing a data structure
        2.- Using global variables (not good threading support)
        3.- Passing window to gpointer and searching.

        4.- Use GObjects for you UI

In my apps I don't directly insert e.g. a gtk_hbox, but derive a class from it (e.g. MyOptionGroup) and this class has aditional datafields. The callback gets the pointer to the instance of the MyOptionGroup as user_data.

Stefan


But the point is.
What is the best way? Is there any other way to do that? Because
structure option looks more suitable for different data to be passed not
just widgets...

I tried to set the widgets as user-data of the widget to be triggered.
But it seems not to work.

I will look anyway in the older mailing list.

Thank you.




On Tue, Mar 28, 2006 at 09:38:20AM +0200, Gonzalo Aguilar Delgado wrote:


Because receiver callback is getting only the receiver widget,

In addition, the callback gets an arbitrary pointer passed
as user_data to g_signal_connect().  A pointer can be used
to pass anything.

This is a very frequently asked question, search the
archives for discussion...

Yeti


--
That's enough.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]