"button_press_event" signal instead of "toggled"



Ok, I'll ask it in another way:

If I create a check button and want to differentiate between "toggled"
event and a "button_press_event" emitted because the right button has
been pressed, can I connect only the "button_press_event" signal and
then ask in my callback which button has been pressed? Something like
this..

gtk_signal_connect_after (GTK_OBJECT(_boolean_button),
"button_press_event",
	                  GTK_SIGNAL_FUNC(CB_ChangedValue), (gpointer) this);


voi CB_ChangedValue  (GtkWidget* widget, GdkEventButton* event, gpointer
cd)
{
if (event->button == 1) {

 /* "toggled" */

} else if (event->button == 3) {

	/* right button code */

	}
}

The gtk_toggle_button_set_active() function causes the "clicked" and
"toggled" signals to be emitted from the button if the state is actually
changed. Can this be a problem for me?

When I create the button and use gtk_toggle_button_set_active() to set
it TRUE it works fine.
But then, when I press the button to toggle the state my callback is
called because of the "button_press_event". "_boolean_button->active"
turns into FALSE but the button toggled twice, so it remains pressed-in.
After this first callback, if I press again it toggled only once, but
know FALSE is "pressed-in" and TRUE "raise-out". 

Is there any problem connecting the "button_press_event" signal instead
of "toggled"? What's going wrong?

Thanks in advance,
	Ignacio Nodal




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