gtk_widget_show() not showing window
- From: "G. Paul Ziemba" <pz-gtk-app-devel-list treehouse napa ca us>
- To: gtk-app-devel-list gnome org
- Subject: gtk_widget_show() not showing window
- Date: Mon, 27 Aug 2007 19:00:46 +0000 (UTC)
Greetings,
gtk_widget_show() does not seem to be operating the way I expect;
could one of the experts please tell me if something is wrong with
this code or if something is wrong with gtk?
When I run this small bit of code, the window appears briefly
and then disappears immediately. The program does not exit.
I expect the window to stay visible (due to gtk_widget_show()),
but it's not happening.
many thanks!
Versions:
OS: FreeBSD 6.2-STABLE #0: Sun Jun 3 19:55:09 PDT 2007
gtk: gtk-2.10.12, gtk-2.10.14
Test program compiled with:
gcc -o test test.c `pkg-config --cflags --libs gtk+-2.0`
Test Program:
#include <gtk/gtk.h>
static void
button_clicked_cb(GtkButton *button, gpointer data)
{
GtkWidget *window2;
window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show_all(window2);
gtk_widget_hide(window2);
gtk_widget_show(window2);
}
int
main(int argc, char **argv)
{
GtkWidget *window;
GtkWidget *button;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window), "delete_event",
G_CALLBACK(gtk_main_quit), NULL);
button = gtk_button_new_with_label("Click me");
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(button_clicked_cb), NULL);
gtk_container_add(GTK_CONTAINER(window), button);
gtk_widget_show_all(window);
gtk_widget_hide(window);
gtk_widget_show(window);
gtk_main();
return 0;
}
--
G. Paul Ziemba
FreeBSD unix:
11:56AM up 23 days, 1:16, 12 users, load averages: 0.18, 0.35, 0.32
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]