Bug 10904 - [GTK] SpinButton doesn't initially display the text set
Summary: [GTK] SpinButton doesn't initially display the text set
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: Trunk
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Michael Natterer
URL:
Depends on:
Blocks:
 
Reported: 2013-03-05 08:58 UTC by Jérémie Laval
Modified: 2013-08-26 15:54 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jérémie Laval 2013-03-05 08:58:55 UTC
When initially, setting up a spinbutton with a text value (ie .Numeric = false and .Text = "some text") its entry will display 0.

Setting text afterwards works fine and, as the currently used workaround, having an expose callback running last that re-set the text value to itself works so something must be happening in the layout/expose machinery that overwrites the entry final text.
Comment 1 Aleksander Morgado 2013-03-06 13:07:42 UTC
When the widget is first realized and there is nothing connected to the 'output' signal (the one allowing to translate between numbers and strings in the output), GtkSpinButton is basically just relying on the default output generator, which takes the internal adjustment value and prints it, that's why you get the default 0.0 value there.

The lack of a proper output processor method connected to the signal is probably the real problem here. Although, as it is fine to set the text value afterwards even without this output processor method, it probably is a good idea to also allow to set it initially before the widget is realized.

The required change should just be something like this (in gtk_spin_button_realize()):

-  if (return_val == FALSE)
+  if (return_val == FALSE  && !gtk_entry_get_text (GTK_ENTRY (spin_button))
    gtk_spin_button_default_output (spin_button);

Will open a bug upstream and suggest the change there.
Comment 2 Aleksander Morgado 2013-03-06 13:31:41 UTC
https://bugzilla.gnome.org/show_bug.cgi?id=695312
Comment 3 Aleksander Morgado 2013-03-08 09:08:29 UTC
This patch is already in gtk-2-24, could be added to the GtkSharp builds now:

http://bugzilla-attachments.gnome.org/attachment.cgi?id=238221
Comment 4 Michael Natterer 2013-06-18 17:41:45 UTC
This bug should be closed as FIXED I suppose, we are using the upstream fix.
Comment 5 Cody Russell 2013-08-26 15:54:08 UTC
Looks like this should be closed.