When I click the button the subwindow shows up but the label is missing in action.
I thought that this line --> while (g_main_context_iteration(NULL, FALSE)); would make both the subwindow and the label show up without having to re-visit gtk_main(), but obviously that's not the case. Unsurprisingly the window doesn't show up at all without that line but what happened to the label? -- MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com www.creekfm.com - FIFTY THOUSAND WATTS of POW WOW POWER!
#include <gtk/gtk.h> #include <unistd.h> void subroutine(GtkWidget *button, gpointer data); int main( int argc, char *argv[]) { GtkWidget *window, *button; gtk_init(&argc, &argv); window=gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); button=gtk_button_new_from_stock(GTK_STOCK_OK); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(subroutine), NULL); gtk_container_add(GTK_CONTAINER(window),button); gtk_widget_show_all(window); gtk_main(); return 0; } void subroutine(GtkWidget *button, gpointer data) { GtkWidget *subwindow, *label; subwindow=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(subwindow), 400, 50); label=gtk_label_new("Label"); gtk_container_add(GTK_CONTAINER(subwindow),label); gtk_widget_show_all(subwindow); while (g_main_context_iteration(NULL, FALSE)); sleep(5); gtk_widget_destroy(subwindow); return; }
_______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list