[glade--]Getting handles to Gtk Objects

Douglas Roberts <[email protected]>
Newsgroups gmane.comp.gnome.glademm
Message-ID <[email protected]>
Hi.

I've been in discussion with the folks on the gtkmm list trying to find 
out how to get handles to the gui objects created when you save an 
application with glade-2/gtkmm as C++ code.  I'll include a snippet from 
one of the messages on that list to ask my question, as it nicely 
summarized my problem:

Thanks,

--Doug


SNIP
-------
Yep, you've about got it summarized, with one minor twiddle:  you can't 
even get hold of pointers to the main windows where the other 
object-wrapped widgets (like Gtk::button, Gtk::entry, etc., etc.) 
reside, unless you edit the glademm-generated code to re scope them to 
be global as well.  Not an acceptable solution, because 1) global 
scoping is bad here, and 2) those files get over-written each time you 
save the GUI C++ code from glade.


Matthew Walton wrote:

This is the situation as I understand it:

- you can use glademm-generated code to instantiate the window class
with the signal handlers intact, as you like, but you can't then
retrieve pointers to the individual widgets in the window
- you can use libglademm to make the window out of the glade XML file,
but then you don't get the callbacks although you do get the ability to
lookup individual widgets

I'm not an expert on either glademm or libglademm (and despite the
similarity in names, they *are* different), but it seems that this
problem may, unless something's being overlooked in glademm's code, be
unresolvable at the current time. libglademm will never pay attention to
the callbacks, because the only thing it considers is the XML file
describing the UI, which, as far as I'm aware, has no information about
interactions between the components at all - that's left to the
programmer.

Thus you're left with glademm, and if that doesn't provide you with
access to the widgets in the window you've got a problem - and to be
honest, I think it probably should have a way to do that, and it may
already have one; although judging by the code snippet in one of your
e-mails it's not looking particularly hopeful.

Feature enhancements to glademm should be discussed on the glademm list
of course.

----
SNIP


-- 
===============================================================
Douglas Roberts, CCS-5          |  "He has no enemies, but is
Los Alamos National Laboratory  |    intensely disliked by his
^                               |    friends."
(505)-667-4569                  |
[email protected]                   |    - Oscar Wilde
===============================================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.