GtkButton problem



I wrote some days ago that I had problems with disabling a button in its own signal handler. I have done some more testing and its seems like this is the case. The following is the test program I used:


#include <gtk/gtk.h>

GtkWidget *button1, *button2, *button3;

static void button1_pressed(GtkButton *button, gpointer data)
{
 gtk_widget_set_sensitive(button1, FALSE);
}

static void button2_pressed(GtkButton *button, gpointer data)
{
 gtk_widget_set_sensitive(button1, TRUE);
}

static void button3_pressed(GtkButton *button, gpointer data)
{
 gtk_widget_set_sensitive(button1, FALSE);
}

int main(int argc, char *argv[])
{
 gtk_init(&argc, &argv);

 GtkWidget *window = gtk_window_new (GTK_WINDOW_DIALOG);

 GtkWidget *vbox = gtk_vbox_new (true, 5);
 gtk_container_add (GTK_CONTAINER (window), vbox);

 button1 = gtk_button_new_with_label("Button 1");
 gtk_container_add(GTK_CONTAINER(vbox), button1);
gtk_signal_connect (GTK_OBJECT (button1), "pressed", GTK_SIGNAL_FUNC(button1_pressed), NULL);

 button2 = gtk_button_new_with_label("Button 2");
 gtk_container_add(GTK_CONTAINER(vbox), button2);
gtk_signal_connect (GTK_OBJECT (button2), "pressed", GTK_SIGNAL_FUNC(button2_pressed), NULL);

 button3 = gtk_button_new_with_label("Button 3");
 gtk_container_add(GTK_CONTAINER(vbox), button3);
gtk_signal_connect (GTK_OBJECT (button3), "pressed", GTK_SIGNAL_FUNC(button3_pressed), NULL);

 gtk_widget_show_all(window);

 gtk_main();

 return 0;
}


When button1 is pressed it disables itself, when button2 is pressed it enables button1, and when button3 is pressed it disables button1. When I press button2 or button3 it works as expected, but when button1 is pressed the interface frezes. The buttons are still exposed (i.e., if a move another window over this window and then move it away the buttons are still visible), but I can't press any of the buttons. Is this a bug?


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp





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