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 106574 - Inconsistent increment behavior for gtkspinbutton
Inconsistent increment behavior for gtkspinbutton
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.2.x
Other other
: Normal normal
: Small fix
Assigned To: gtk-bugs
gtk-bugs
: 157781 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-02-20 00:45 UTC by msf
Modified: 2008-05-27 22:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Commit value before keyboard scrolling it (803 bytes, patch)
2008-05-19 01:56 UTC, Björn Lindqvist
committed Details | Review

Description msf 2003-02-20 00:45:16 UTC
Create a spinbutton

Click to focus the entry area

Erase and replace the number with a new number substantially different
(call it N)

Click on the 'up' arrow control for the widget, the value with goto N+<step>

Now enter another substantially different number (call it P)

Hit the 'up-arrow' on the keyboard. You will goto N+2*<step>, not P+<step>

NOTE - do not hit '<return>' after enter the numbers in the above instructions
Comment 1 Matthias Clasen 2003-02-24 19:15:16 UTC
I think this actually behaves as intended, since the text entered with
the keyboard doesn't actually change the value of the spinbutton until
you hit return. This is a bit confusing, because the entry somehow
doubles as both a n observer of the spinbutton value (when using the
mouse) and as an input buffer to assemble the value to change to upon
hitting return.

Maybe the behaviour could be improved by making the buttons commit the
entry text before doing the increment.
Comment 2 Owen Taylor 2003-05-19 22:00:03 UTC
Commit before changing values makes sense to me.
Comment 3 Elijah Newren 2004-06-19 18:43:34 UTC
Mass changing gtk+ bugs with target milestone of 2.4.2 to target 2.4.4, as
Matthias said he was trying to do himself on IRC and was asking for help with. 
If you see this message, it means I was successful at fixing the borken-ness in
bugzilla :)  Sorry for the spam; just query on this message and delete all
emails you get with this message, since there will probably be a lot.
Comment 4 Matthias Clasen 2004-12-23 20:02:51 UTC
*** Bug 157781 has been marked as a duplicate of this bug. ***
Comment 5 Björn Lindqvist 2008-05-19 01:56:26 UTC
Created attachment 111126 [details] [review]
Commit value before keyboard scrolling it

Patch that fixes the problem like you suggested it. Here is the test case:

    adj = gtk.Adjustment(1, 0, 100, 1, 10, 10)
    spin = gtk.SpinButton(adj, 1, 2)
    spin.set_text('5')
    gtk.bindings_activate(spin, gtk.keysyms.Up, 0)
    assert spin.get_value() == 6
Comment 6 Matthias Clasen 2008-05-23 23:19:18 UTC
Looks right to me. Please commit.
Comment 7 Matthias Clasen 2008-05-27 22:51:09 UTC
        106574 - Inconsistent increment behavior for gtkspinbutton

        * gtk/gtkspinbutton.c (gtk_spin_button_real_value_change):
        Commit the entry text before doing an increment. Patch by
        Björn Lindqvist.