Re: mixing widgets via glade and standard way ? (newbie)



On Feb 3, 2008 8:41 AM, Fred Müller <fmue pab-opto de> wrote:

Dear folks,

I'm wondering whether XML/glade based widget creation and 'standard'
widget creation combine.
All widgets are generated by libglade-2.0. Changing the text in an
existing label works, adding a label to the table doesn't:

{
       GtkWidget *l, *tl;
       if( !(tl=glade_xml_get_widget( pgcw.xml,
"table_mancontrol_lamps" )) ) {
               fprintf(stderr,"%s: can't get lamp table widget\n",
__func__ );
               return(-1);
       }
       l=gtk_label_new("foo");
       gtk_table_attach_defaults( GTK_TABLE(tl), l, 2,3,2,3 );
       return(0);
}

Are standard gtk calls failing since glade changes some internal
callbacks when creating the table, or am I missing something obvious ?
(I wouldn't think its some buffer issue, since the above routine gets
called once via g_idle_add and the label doesn't appear after
resizing/iconify). table size is 4x4 in the XML file.


 Could it simply be that you forgot to gtk_widget_show() the label ?

libglade doesnt do anything sinister that I know of to tables, the fact
that you are modifying a constructed table may change things, could
your widget be shown underneath another widget already on the table ?



Second question:

Entries to a notebook all use the same layout and different variable
space. The layout for the first page is generated, amongst the rest of
the GUI, using XML/libglade, the others are to be cloned at runtime
(number of notebook pages is only kown at runtime). What's the "good"
way to do this ?
I realize one way is to use glade_xml_new with root and domain options
and attached the tree at the notebook. Right ?
Is there a general way to cut/paste a widget subtree to a different node
within Gtk ?


No there is no safe object copying mechanism in place, nor is there a
recursive
one, better to use the "root node" argument like you mentioned to build
templates
and just modify them as needed while adding to the interface.

Cheers,
                       -Tristan



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