Sorry, I think I didn't explain the problem well enough. >From: Murray Cumming <[EMAIL PROTECTED]> >To: Robert Caryl <[EMAIL PROTECTED]> >CC: Nickolai Dobrynin <[EMAIL PROTECTED]>,Josepo Urrutia ><[EMAIL PROTECTED]>, [email protected] >Subject: Re: Control user change of SpinButton value >Date: Sun, 16 Jul 2006 10:19:50 +0200 > >On Sat, 2006-07-15 at 10:49 -0500, Robert Caryl wrote: > > Josepo wrote: > > > 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. > > Evidently, Josepo wishes to prevent change of the Gtk::SpinButton > > object's value by the user under certain circumstances. > >Can't he just use set_sensitive(false)? >
What I need is to know if the change on a spinbutton has been solicited by the user or by the code. If the change has been done by the user I need to execute some extra function that don't have to be executed if the change has been done by the code. Thats why I asked if there is a generic signal to a user modification of the spinbutton apart from signal_value_change. > > 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. > > > > 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 > > Relax everybody, sarcasm is bad for health. :-) > > > > Nickolai Dobrynin wrote: > > > Josepo, > > > > > > You can try connecting to Glib::SignalProxy1<bool,GdkEventKey*> > > > Gtk::Widget::signal_key_press_event(). > > > The callback then is a good place to check whether it was an arrow > > > key that got pressed. > > > > > > Btw, using a mutex for this purpose, as Bob had suggested, seems > > > like a huge overkill to me. > > > > > > > > > Regards, > > > > > > Nickolai > > > > > > ____________________________________________________________________ > > > > > > _______________________________________________ > > > gtkmm-list mailing list > > > [email protected] > > > http://mail.gnome.org/mailman/listinfo/gtkmm-list > > > > > _______________________________________________ > > gtkmm-list mailing list > > [email protected] > > http://mail.gnome.org/mailman/listinfo/gtkmm-list >-- >Murray Cumming >[EMAIL PROTECTED] >www.murrayc.com >www.openismus.com > _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
