Re: [gtkmm] Glade-2, libgtkmm, Xml::create, callbacks



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.

Thanks for all the feedback, I shall now go see if the glademm people can help.

Cheers,

--Doug

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.

On Wed, 2003-09-03 at 18:27, Douglas Roberts wrote:
  
Glade/glademm already saves all callback methods defined by the user. 
The callback code, with the appropriate signal handling is saved as
valid C++ code.  The problem is that glade/glademm does not give you a
handle to the gui objects that it creates, so that unless you go into
the code that glade/glademm wrote there the Gtk::objects are created,
and re-declare them at a global scope, you have no way to get a handle
to the Gtk::objects.

It sounds like you might not have used glade-2 to save a gui with C++
bindings.

Murray Cumming wrote:
    
On Wed, 2003-09-03 at 19:01, Douglas Roberts wrote:
  
      
The problem is that the callback functions defined by glade, and 
declared in the "app_name".glade file are ignored when you instantiate 
your gui application via Glib::RefPtr<Gnome::Glade::Xml> refXml;
    
        
Again, how did you expect Glade to know about the instance of the
signal-handling class? Or did you want to use a static function? That
would not be very useful in C++.

      

  

-- 
===============================================================
Douglas Roberts, CCS-5          |  "He has no enemies, but is
Los Alamos National Laboratory  |    intensely disliked by his
^                               |    friends."
(505)-667-4569                  |
dzzr lanl gov                   |    - Oscar Wilde
===============================================================


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