Re: How to stop signal in the folowing case?



>Hello,
>
>Lets assume we have two spinbuttons (spinbutton_A and spinbutton_B), if 
>I change one of the spinbuttons the callback functions:
>
>void on_spinbutton_A_changed (GtkEditable *editable, gpointer user_data) {
>    gtk_spin_button_set_value( spinbutton_B, MY_VALUE );
>}
>
>void on_spinbutton_B_changed (GtkEditable *editable, gpointer user_data) {
>    gtk_spin_button_set_value( spinbutton_A, MY_VALUE );
>}
>
>are called, now as you can see, this is an never ending recursion. When 
>I change spinbutton_A, spinbutton_B is changed too and so his callback 
>function is called and so spinbutton_A is changed ...

this doesn't cause never ending recursion if MY_VALUE is a single
value. gtk_spin_button_set_value (foo, val) does nothing if "val" is
equal to the current value.

this is a classic problem for Model-View-Controller programming, and
blocking the signal is not normally the right way to deal with it.

how do you compute MY_VALUE?



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