[Glade-users] How can I call an element of one window from another window?



"TAZ Gravel, Emmanuel" wrote:

I'm trying to set callback functions in one window of an application
so they have an effect on objects in other windows (all the same
executable of course). The only way I've found up until now is to
make the different window widgets as global variables within
main.c, and creating them as extern globals in other sources,
so I can access their different elements:

window1->container_widget5->entry3 (as an example) where
window1 is a global everywhere. I've been browsing at the GTK+
docs I've been able to find but nothing seems to indicate to
me what the best course of action is yet.

Any ideas?

Using globals is OK for simple apps.

For complex apps where you want to avoid globals, you can use gtk_object_set_data()
etc. to store pointers to windows inside other windows.

But you need to ensure that the pointer is removed when the window is destroyed,
since it will become invalid.

Damon







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