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



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)






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