[Glade-users] Loading widgets from XML file using libglade

If you read the description of the glade_xml_get_widget() (
you will see that this returns the pointer to the widget which you loaded
with glade_xml_new(). First time you have added this widget to the container
what set its 'parent'. When you call this function second time, you are
obtaining pointer to the same widget.

What is your intention? Do you want to realize something like gtk_notebook?
If yes, why not to use it?

LUK (gromot)

2009/12/17 Andrew Wood <ajwood at theiet.org>

Thanks thats sorted it. But how do I update the contents of a container
on the fly. For example Ive defined the following function which is
called when the program starts and loads the widgets from Glade no problem:

void showPage1()
       //load page1 from Glade and set as content in rightpanevbox
        rightpanevbox= glade_xml_get_widget(page1xml,"mainvbox");

       pagedisplayed = "Page1";


If however I call this function later on a second time I get that same
Gtk-CRITICAL **: gtk_scrolled_window_add_with_viewport: assertion
`child->parent == NULL' failed

Im assuming this is because the scrolled window already has something in
it which I first need to remove?

Lukasz Gromotowicz wrote:
As far as I can see, the Gtk-Critical fault says that you can not put
the widget onto another parent because it already has a parent. The
second parameter in the glade_xml_new() is for the root widget node.
Try this:


and then

rightpanevbox= glade_xml_get_widget(page1xml,"mainvbox");

Hope it works,
good luck.

LUK (gromot)

Glade-users maillist  -  Glade-users at lists.ximian.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20091218/5b672d9c/attachment.html 

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