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

Lukasz Gromotowicz gromot at gmail.com
Fri Dec 18 10:46:40 EST 2009


If you read the description of the glade_xml_get_widget() (
http://library.gnome.org/devel/libglade/unstable/GladeXML.html#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?

Regards,
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");
>         glade_xml_signal_autoconnect(page1xml);
>
>        pagedisplayed = "Page1";
>
>
>
> gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(rightpanescrollview),rightpanevbox);
> }
>
> If however I call this function later on a second time I get that same
> error:
> 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:
> >
> > page1xml=glade_xml_new("./page1.glade","mainvbox",NULL);
> >
> > 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
> http://lists.ximian.com/mailman/listinfo/glade-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20091218/5b672d9c/attachment.html 


More information about the Glade-users mailing list