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

Re: Finding a widget in a Glade interface



> I should have mentioned that by time I want to call
>> glade_xml_get_widget() the GladeXML *xml created by xml =
>> glade_xml_new("filename.glade", NULL, NULL); is out of scope.  If I call
>>  open the file again to get the widget it has no affect on the running
>> window.  I need to get the widget from the running window from some
>> callback.  Any ideas?
>
> Make 'GladeXML *xml' static or otherwise accessible from all parts of the
> sourcecode.
>
> tom
>

Not a good idea. I had a similar question some time back, the xml
structure returned by glade_xml_new is too "heavyweight" to be
retained for a long time by your program, and it contains no useful
information aside from being able to pull out pointers to widgets. A
more apt way to do this would be to store pointers to all the widgets
you need soon after glade_xml_new (perhaps as members of a struct),
then dereference the GladeXML object. When you set up your callbacks,
have this structure passed as the "user" pointer. Now all callbacks
have access to the widgets in your window.

In addition to the examples posted earlier, you can also download the
source to any standard gtk program for additional examples. I used the
devhelp source for this.
-Jim


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