After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 314926 - GtkSpinButton is not listening for GtkEntry changes
GtkSpinButton is not listening for GtkEntry changes
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkSpinButton
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
gtk-bugs
: 143832 312925 409268 507229 642529 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-08-31 08:13 UTC by Dirk Huenniger
Modified: 2018-04-15 00:06 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dirk Huenniger 2005-08-31 08:13:59 UTC
Distribution/Version: Debian

Build a GUI with Glade and Simplegladeapp.
Add a callback like this

def on_timeentry_changed(self, widget, *args):
   print widget.get_value(), widget.get_text()

Type the value 178.3 into the Spinbutton.
Move the curser between 7 and 8 in the Spinbutton. Type 3
Result:
178.3 1738.300


If you change the code a bit:

def on_timeentry_changed(self, widget, *args):
   widget.update()
   print widget.get_value(), widget.get_text()

You get:
1738.3 1738.300

So please run the update method in the beginning of the get_value method
Comment 1 Johan (not receiving bugmail) Dahlin 2005-08-31 15:16:16 UTC
Seems to be true.

Simplified testcase:

sb = gtk.SpinButton()
sb.set_range(0, 1)
sb.set_text('1')
assert sb.get_value() == 1

GtkSpinButton should listen to changes made by gtk_entry_set_text()

Moving to gtk+.
Comment 2 Matthias Clasen 2005-09-01 23:37:50 UTC
the spinbutton does acknowledge entry changes, but only upon focus-out.
Comment 3 Peter Johanson 2007-01-19 22:11:43 UTC
This just bit us in the proverbial ass at work today. In particular, if you at trying to fetch the value_as_int in response to a button activated with a mnemonic, which does *not* trigger a focus-out on the GtkSpinButton, so the value is wrong. This is also a problem for us when using dogtail to do UI testing, as dogtail/AT-SPI stuff can trigger a button click without changing the focus away from the GtkSpinButton. Should this really be assigned to nobody@pygtk.org? This is a problem in general with GtkSpinButton (I can provide a simple C test case if you'd like). Thanks in advance.
Comment 4 Dirk Huenniger 2007-01-20 12:49:27 UTC
Threre is workaround for that. You can create two spinbuttons. One you use for display and one for value readout. You have to think about one when to update which one, but this way you can create a wrapper class for gtk.spinbutton that will behave correctly. I know that this is the worst possible solution to the problem, but I will provide a such a wrapper class in Python if somebody feels s/he needs it. Our 1m Telescope is running on that for one year now :-)
Comment 5 Xan Lopez 2007-01-23 16:19:14 UTC
*** Bug 312925 has been marked as a duplicate of this bug. ***
Comment 6 Xan Lopez 2007-01-23 16:30:59 UTC
*** Bug 143832 has been marked as a duplicate of this bug. ***
Comment 7 Paul Pogonyshev 2007-01-23 19:23:36 UTC
Really smart.  Bug 143832 was opened 2.5 years ago and contains a test case.  How can it possibly be a duplicate of this one is beyond me.
Comment 8 Michael Ekstrand 2007-02-13 21:35:53 UTC
This one (in the form of 14382) has now bitten me.  The focus-out behavior doesn't seem very obvious or intuitive to me - I can query the contents of a text entry or position of a slider at any time, but not the value of a spin button?

If, however, there is a good reason for this behavior and it shouldn't change, some documentation of this feature, its rationale, and the appopriate workaround (gtk_spin_button_update) in the GtkSpinButton docs would be useful IMO.
Comment 9 Xan Lopez 2007-02-20 12:48:42 UTC
*** Bug 409268 has been marked as a duplicate of this bug. ***
Comment 10 Matthias Clasen 2009-07-11 02:40:24 UTC
*** Bug 507229 has been marked as a duplicate of this bug. ***
Comment 11 Cosimo Cecchi 2012-10-30 17:20:52 UTC
*** Bug 642529 has been marked as a duplicate of this bug. ***
Comment 12 Matthias Clasen 2018-02-10 05:15:28 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 13 Matthias Clasen 2018-04-15 00:06:19 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new