Re: [glade--]customizing

Christof Petig <[email protected]>
Newsgroups gmane.comp.gnome.glademm
Organization Adolf Petig GmbH & Co. KG
Message-ID <[email protected]>
Martin Cole wrote:
> Hi,
> 
> My project is attempting to just depend on the .glade xml files and use 
> libglademm to realize the gui's.
> 
> I could not find a way to tell libglade to instantiate my custom widget 
> instead of its own (drawing area) widget.
> 
> So for a proof of concept I got the widget by name, found its parent, 
> removed the widget from the parent, added my instantiated widget in its 
> place... like so:

Why bother removing the widget in the first place. Do not add it in 
glade and ask for the parent, then construct and add it.

Perhaps you should ask on the libglade[mm] mailing list since this issue 
is only peripherally connected to glade--.

> SimpleGLScene *ogl_widget = new SimpleGLScene();
> parent->add(*ogl_widget);
> 
> parent->show_all_children(true);

ogl_widget->show(); should be enough.

> Clearly my inexperience with gtk shows :)
(this is gtkmm - be glad for your inexperience with gtk+)

> I am guessing there is a much better way to do this, could someone point 
> me in the right direction?

It should be possible to implement this code in glade-- if you want to 
take that road. In a way that glade-- emits a skeleton for your program 
(and takes care of the custom widgets). But this has not been done and 
perhaps it's even necessary to patch libglade to leave custom widgets 
alone to get this accomplished.

Perhaps libglade tries to call a C like creation function - try to 
provide this in your program (if libglade supports this).

   Christof
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.