Reputation: 2803
I've got some code which populates a GtkVBox with new widgets from some data, after the UI is initially built.
So there's some code which runs later looking something like this:
gchar* str = "something or other";
ascii_labels [i] = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (ascii_labels [i]), str);
ascii_event_boxes [i] = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (ascii_event_boxes [i]),
ascii_labels [i]);
gtk_box_pack_start (GTK_BOX (ascii_box),
ascii_event_boxes [i],
FALSE, FALSE, 0);
in some loop. A bit later I have
gtk_widget_show_all (ascii_box);
to set visibility. This seems to work, in that when I run the resulting application with GtkParasite, I can see the widgets nested correctly in the Widget Tree and they are set to be visible.
Unfortunately, they don't actually appear in the application's window! The reason I think I'm missing some sort of "update yourself please" call is that if I toggle the visibility of one of those widgets from the GtkParasite tool, all the other widgets that were missing magically appear!
Can anyone tell me what I'm missing?
Upvotes: 2
Views: 317
Reputation: 11454
The packing looks good, but what we need here is to know what ascii_labels
contains, and how it's defined. The problem is not visibility, as gtk_widget_show_all
takes care of that for you.
Upvotes: 1