В Пнд, 26/02/2007 в 02:29 -0800, johnmb пишет: > My gtkmm / gtk+ project is running well bar a couple of minor problems to do > with buttons and I wonder whether anyone has any suggestions. My problems > are :- > > 1.) If I click on a button, it responds as it should and my signal > connection activates the appropriate methd. If, however, I cliock on the > same button without moving the mouse pointer, it doesn't respond no matter > how many times I click. If I then move away from the button and click > somewhere else and then move back to the button and click, it works again. > > 2.) Generally, the buttons work OK, but occasionally a button will stick > down without activating its signal. I hasve to click on it again to free it > and activate the signal. > > It could be that these problems have the same root - I don't know but any > suggestions are welcome. > > John
There is issue: http://bugzilla.gnome.org/show_bug.cgi?id=56070 In my application I have to use some trick to fix that problem: void fix_button( GtkWidget* widget ) { gint width, height; gint x, y; g_return_if_fail( GTK_IS_BUTTON( widget ) ); // button dimensions width = widget->allocation.width; height = widget->allocation.height; // mouse pointer in widget coordinates gtk_widget_get_pointer( widget, &x, &y ); // check if pointer is over button if( x >= 0 && x < width && y >= 0 && y < height ) GTK_BUTTON( widget )->in_button = true; // setting } you should call that function, when signal_clicked() handler is done. File gtkbutton.c. There is function gtk_button_grab_notify() that drop in_button flag. Also, gtk_button_update_state() drops in_button flag when button widget is insensitive, but doesn't restore it in other case. So, when you hit button first time it works well, and drops in_button flag. Now if you don't move mouse pointer out-in button area it won't generate signal "clicked" anymore. Regards, -andrew PS It would be great if you could specify GTK+, GTKMM versions you have installed. _______________________________________________ gtk-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtk-list
