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 507229 - spinbutton values are not saved when using ALT+OK instead of clicking on OK button with mouse
spinbutton values are not saved when using ALT+OK instead of clicking on OK b...
Status: RESOLVED DUPLICATE of bug 314926
Product: gtk+
Classification: Platform
Component: Widget: GtkSpinButton
2.12.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-01-04 10:44 UTC by Raphael
Modified: 2009-07-11 02:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Raphael 2008-01-04 10:44:48 UTC
Please describe the problem:
Entering text in a spinbutton field and pressing ALT+O for the OK button to close the window where the spinbutton is, does not save the spinbutton value.

Below are workarounds/inconsistencies

If you start to type text, it is only saved to spinbutton value if you move focus away from it (eg by tab).
If you to arrow up/down, then the value is changed immediately.
Clicking the Ok button (we use a stock gtk-ok button) gives focus to the OK button and stores the value, then emits the ok event.


Steps to reproduce:
1. Click on a spinbutton value field.
2. Use the keyboard to enter some text, e.g. a number
3. Use the keyboard shortcut ALT+O to close the window/dialog


Actual results:
When you do ALT+O from the spinbutton, you OK button emits it's event, but the spinbutton value is not saved.

Expected results:
That the spinbutton value is saved.

Does this happen every time?
yes

Other information:
See http://bugs.gramps-project.org/view.php?id=1444 for the original bug report with the gramps program.
Comment 1 Raphael 2008-01-04 10:45:54 UTC
I am using Kubuntu 7.10 with KDE as my desktop.
Comment 2 Mathias Hasselmann (IRC: tbf) 2008-01-04 11:17:15 UTC
Raphael: How do you react on the OK button? "response" signal, "clicked" signal, result of gtk_dialog_run()?

Could you play with gdb and/or printf to figure out, where the "focus-out-event" signal is lost? Or if it is emitted too late?
Comment 3 Benny Malengier 2008-01-04 11:35:27 UTC
Allow me to give proof, it might be pygtk though:

python
Python 2.5.1 (r251:54863, May  2 2007, 16:27:44)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
>>> test = gtk.Dialog(title ="test spin", buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
>>> spinbtt = gtk.SpinButton(adjustment=None, climb_rate=1, digits=0)
>>> spinbtt.set_range(-999, 999)
>>> spinbtt.get_value()
0.0
>>> test.action_area.pack_start(spinbtt)
>>> test.show_all()
>>> test.run()

  Now go to the spinbutton and type a value different from 0., then do ALT+O
-3
>>> spinbtt.get_value()
0.0

  So indeed, still 0 as value, now do the same but use arrow key to change the value to 4, then do ALT+O

>>> test.run()
-3
>>> spinbtt.get_value()
4.0

 SO indeed, now the value is stored, now do the same and use the mouse to click on OK after having typed the value 3 in the spinbutton

>>> test.run()
-3
>>> spinbtt.get_value()
3.0
>>>


So pressing of ALT+O when you have typed in the spinbutton does not store the value, doing a tab, using mouse, using arrows, or if other alt values are present (eg D) doing ALT+D then ALT+O, does store the spinbutton value


Comment 4 Yevgen Muntyan 2009-07-10 09:05:59 UTC
Me too, yay! GtkSpinButton bug.

GtkSpinButton::get_value doesn't look at the entry contents, it just returns the adjustment value. Adjustment is updated only on focus-out and activate. Now it is an interesting question where focus-out gets lost, but regardless spin button should be smart enough to watch entry's changed signal.
Comment 5 Matthias Clasen 2009-07-11 02:40:24 UTC

*** This bug has been marked as a duplicate of 314926 ***