gtk-sharp Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. Gtk.Entry Retrieve an integer or floating-point number from the user. A SpinButton is an ideal way to allow the user to enter a numeric value. Rather than having to directly type a number into an , a SpinButton allows the user to click on one of two arrows to increment or decrement the displayed value. A value can still be typed in, with the added benefit that it can be checked to ensure it is within a given range. To precisely configure a SpinButton, an is used. Though it is not mandatory, its use allows fine control over the 'spinning' properties of the SpinButton. A SpinButton is typically created by setting up an and passing that to the SpinButton's constructor. The value entered by a user can then be retrieved using either the property or the property. The following demonstrates how to get an integer from a SpinButton: // Creates a window with a spin button public void CreateSpinButton() { Window window = new Window(); window.BorderWidth = 5; // Create a spin button for percentage values. SpinButton spinner = new SpinButton(0f, 100f, 1f); spinner.ValueChanged += new EventHandler(OutputValue); window.Add(spinner); window.ShowAll(); } // Handles ValueChanged events and writes to the console private void OutputValue(object source, System.EventArgs args) { SpinButton spinner = source as SpinButton; System.Console.WriteLine("Current value is: " + spinner.ValueAsInt); } Constructor Pointer to the C object. Internal constructor This is an internal constructor, and should not be used by user code. Constructor A A A Creates a new SpinButton based on the specified . Constructor Minimum allowable value. Maximum allowable value. The value to alter the SpinButton by when a is carried out on it. Creates a SpinButton without the need for a manually created . The default value of the new SpinButton is initially set to . The default page increment is set to 10 * . The visible precision of the spin button is equivalent to the precision of . Property GLib.Property("adjustment") Gtk.Adjustment The lower/upper/step range of this widget's values. A Event GLib.Signal("change-value") Gtk.ChangeValueHandler Raised in order to change the button's value. Property GLib.Property("climb-rate") System.Double The acceleration rate when user holds down a button. A Method System.Void An optional to configure certain properties, null otherwise. The value to adjust the SpinButton by when one of its arrows are clicked. The number of decimal places to display. Configures various properties of the SpinButton. An is used to configure a variety of the properties for a SpinButton. See the documentation for the members for more information. Property GLib.Property("digits") System.UInt32 Manage the precision that this SpinButton's value is displayed with. The maximum number of digits that the SpinButton will currently display. Up to 20 digit precision is allowed. Method System.Void Outputs the value that a spin button is changed by when the user clicks with button 1, (usually the left mouse button). Outputs the value that a spin button is changed by when the user clicks with button 2, (usually the middle mouse button). Retrieve the current step and page increments. Method System.Void The minimum value that can be accepted. The maximum value that can be accepted. Find out the minimum and maximum allowed input values. Property GLib.GType GType Property. a Returns the native value for . Event GLib.Signal("input") Gtk.InputHandler Raised when the user inputs a new value. Property GLib.Property("numeric") System.Boolean Manage whether or not the SpinButton accepts non-numeric input. Whether the SpinButton currently accepts only numeric input. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideChangeValue", Type=typeof(Gtk.SpinButton)) System.Void a Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideInput", Type=typeof(Gtk.SpinButton)) System.Int32 a Default handler for the event. a Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideOutput", Type=typeof(Gtk.SpinButton)) System.Int32 Default handler for the event. a Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideValueChanged", Type=typeof(Gtk.SpinButton)) System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event. Method GLib.DefaultSignalHandler(ConnectionMethod="OverrideWrapped", Type=typeof(Gtk.SpinButton)) System.Void Default handler for event. Event GLib.Signal("output") Gtk.OutputHandler Raised when this widget outputs its value. Method System.Void The amount to change the spin button by when the user clicks with button 1, (usually the left mouse button). The amount to change the spin button by when the user clicks with button 2, (usually the middle mouse button). Sets the step and page increments. Changing the values with this method alters how quickly the SpinButton's value changes when its arrows are activated. Method System.Void The minimum value that can be entered. The maximum value that can be entered. Alters the minimum and maximum allowable values. Property GLib.Property("snap-to-ticks") System.Boolean Manage whether values are corrected to the nearest step increment when a SpinButton is activated with an invalid value. if values are snapped to the nearest step, otherwise. Method System.Void A direction that indicates if the SpinButton should be incremented or decremented. The amount to adjust the SpinButton by. Changes the value of the SpinButton by . Method System.Void Forces the SpinButton to update its value Property GLib.Property("update-policy") Gtk.SpinButtonUpdatePolicy The policy for how to update this SpinButton when its value changes. A Property GLib.Property("value") System.Double The current value of the SpinButton. The current value of the SpinButton. The value of the SpinButton is limited by the precision set with the property. Property System.Int32 Retrieve the current value as an integer. The value of the SpinButton with integer precision. Event GLib.Signal("value-changed") System.EventHandler This event is raised after the SpinButton's value changes. Property GLib.Property("wrap") System.Boolean Manage whether a SpinButton's value wraps around to the opposite limit when the upper or lower limit of the range is exceeded. Whether this SpinButton wraps its maximum/minimum values when spinning. If this property is set to , then when the user tries to change the value in a SpinButton, (usually by clicking one of the arrows), the next value after the maximum will wrap to the minimum. Alternatively, if this property is set to , then trying to increase the value of the SpinButton when it is at the maximum value, will have no effect. Likewise when trying to decrement the value at its minimum. Event GLib.Signal("wrapped") System.EventHandler Raised when the value wraps from min to max, or max to min.