Re: SpinButton: how to avoid calling signal handler when set_value()



Have you tried

g_signal_handler_block (gpointer instance, gulong handler_id);

and

g_signal_handler_unblock (gpointer instance, gulong handler_id);

Putting these before and after your set_value() should temporarily block the handler.

You get the handler_id from g_signal_connect(...):

handler_id = g_signal_connect(...);



On 11/01/16 11:29, pozzugno wrote:
I have a SpinButton with an associated Adjustment. I connected a handler for "value-changed" signal, because I have to make something when the user changes the value. I sometimes need to change the value in the code, using set_value() method of SpinButton or Adjustment. In this case, I don't want to execute the signal handler.

I will try to describe the situation. I have many widgets on the window, mainly SpinButton (but I have Entry too). I retrieve the values from remote, so I use set_value() methods for each widget when the values are received. The user can change some values and I need to detect this, because I have to send the new values to remote. So I have to connect a custom signal handler. Of course, I have to avoid calling the signal handler when the values are changed by code.

Is it possible?



_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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