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



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)
How would I do this using GtkBuilder? As far as I can see 
gtk_builder_add_from_file doesnt support a similar argument.

Using gtk_builder_get_object (builder, "mainvbox"))  doesnt stop parent 
widgets being obtained as well.

The mainvbox is in a window in Glade because you have to put it in one, 
but when I read the file into my program I already have a window for it 
to go in, I only need the vbox.

Just doing

gtk_builder_add_from_file (builder, "./gladexml/general.xml", NULL);
        generalpage= GTK_WIDGET (gtk_builder_get_object (builder, 
"mainvbox"));

then

gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(rightpanescrollview),GTK_WIDGET(generalpage));

is giving the error:
 Gtk-CRITICAL **: gtk_scrolled_window_add_with_viewport: assertion 
`child->parent == NULL' failed



Regards
Andrew




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