GNOME Bugzilla – Bug 507229
spinbutton values are not saved when using ALT+OK instead of clicking on OK button with mouse
Last modified: 2009-07-11 02:40:24 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.
I am using Kubuntu 7.10 with KDE as my desktop.
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?
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
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.
*** This bug has been marked as a duplicate of 314926 ***