Josepo wrote:Evidently, Josepo wishes to prevent change of the Gtk::SpinButton object's value by the user under certain circumstances. The Gtk::SpinButton is, quoting the docs: "a numeric Entry with up/down buttons . . . " To accomplish Josepo's stated purpose, Nickolai proposes detection of an arrow key keypress by connecting to Gtk::Widget::signal_key_press_event(). But what about when the user merely enters numbers in the Gtk::Entry widget portion of the Gtk::SpinButton; or, what about when the user clicks on either of the up or down buttons included in the Gtk::SpinButton? To do it Nickolai's way, Josepo must write callback slots to connect to every possible access signal emitted by three widgets: the Gtk::Entry and both of the Gtk::Button objects upon which the user can click with his mouse to change the spin button value. Ergo, using Nickolai's methodology, in order to intercept the user in all the ways he could change the spin button value Josepo must write at least three callback slots connecting to at least three different widgets various signals. Or, Josepo insert a total of seven lines of code necessary to implement a mutex, splitting them between the constructor of his class, his already written Gtk::SpinButton::signal_value_changed callback slot, the function where he programmatically changes the button value, and the destructor of his class; thereby accomplishing his stated purpose.I've some Gtk::SpinButton in my application and I need to control when the user change the values of those spinbuttons. If I use the Gtk::SpinButton::signal_value_changed I can do a callback whenever the value of a spinbutton is changed, the problem is that this callback is also fired if the value is changed by the code not only by the user. Using the Gtk::Entry::signal_activate makes me able to know when the user has enter a value hitting the return key but not by using the mouse over the "up/down" buttons. I've tried with some more signal has Gtk::Widget::signal_button_release but no luck. What was it Nickolai said? Btw, using a mutex for this purpose, as Bob had suggested, seems like a huge overkill to me.I suppose one person's overkill is another person's simplicity. Bob Caryl Nickolai Dobrynin wrote: Josepo, |