<Type Name="SpinButton" FullName="Gtk.SpinButton"> <TypeSignature Language="C#" Value="public class SpinButton : Gtk.Entry, Editable, IWrapper, CellEditable, Implementor, IWrapper, IWrapper, IDisposable" Maintainer="Lee Mallabone" /> <AssemblyInfo> <AssemblyName>gtk-sharp</AssemblyName> <AssemblyPublicKey> </AssemblyPublicKey> <AssemblyVersion>0.0.0.0</AssemblyVersion> <AssemblyCulture>neutral</AssemblyCulture> <Attributes /> </AssemblyInfo> <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement> <Docs> <summary>Retrieve an integer or floating-point number from the user.</summary> <remarks> <para>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 <see cref="T:Gtk.Entry" />, 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.</para> <para>To precisely configure a SpinButton, an <see cref="T:Gtk.Adjustment" /> is used. Though it is not mandatory, its use allows fine control over the 'spinning' properties of the SpinButton.</para> <para>A SpinButton is typically created by setting up an <see cref="T:Gtk.Adjustment" /> and passing that to the SpinButton's constructor. The value entered by a user can then be retrieved using either the <see cref="P:Gtk.SpinButton.Value" /> property or the <see cref="P:Gtk.SpinButton.ValueAsInt" /> property.</para> <para>The following demonstrates how to get an integer from a SpinButton: <example> <code lang="C#"> // 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); } </code> </example></para> </remarks> </Docs> <Base> <BaseTypeName>Gtk.Entry</BaseTypeName> </Base> <Interfaces> <Interface> <InterfaceName>Gtk.Editable</InterfaceName> </Interface> <Interface> <InterfaceName>GLib.IWrapper</InterfaceName> </Interface> <Interface> <InterfaceName>Gtk.CellEditable</InterfaceName> </Interface> <Interface> <InterfaceName>Atk.Implementor</InterfaceName> </Interface> <Interface> <InterfaceName>GLib.IWrapper</InterfaceName> </Interface> <Interface> <InterfaceName>GLib.IWrapper</InterfaceName> </Interface> <Interface> <InterfaceName>System.IDisposable</InterfaceName> </Interface> </Interfaces> <Attributes /> <Members> <Member MemberName="Spin"> <MemberSignature Language="C#" Value="public void Spin (Gtk.SpinType direction, double increment);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="direction" Type="Gtk.SpinType" /> <Parameter Name="increment" Type="System.Double" /> </Parameters> <Docs> <summary>Changes the value of the SpinButton by <paramref name="increment" />.</summary> <param name="direction">A direction that indicates if the SpinButton should be incremented or decremented.</param> <param name="increment">The amount to adjust the SpinButton by.</param> <remarks /> </Docs> </Member> <Member MemberName="GetRange"> <MemberSignature Language="C#" Value="public void GetRange (out double min, out double max);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="min" Type="System.Double&" RefType="out" /> <Parameter Name="max" Type="System.Double&" RefType="out" /> </Parameters> <Docs> <summary>Find out the minimum and maximum allowed input values.</summary> <param name="min">The minimum value that can be accepted.</param> <param name="max">The maximum value that can be accepted.</param> <remarks /> </Docs> </Member> <Member MemberName="Configure"> <MemberSignature Language="C#" Value="public void Configure (Gtk.Adjustment adjustment, double climb_rate, uint digits);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="adjustment" Type="Gtk.Adjustment" /> <Parameter Name="climb_rate" Type="System.Double" /> <Parameter Name="digits" Type="System.UInt32" /> </Parameters> <Docs> <summary>Configures various properties of the SpinButton.</summary> <param name="adjustment">An optional <see cref="T:Gtk.Adjustment" /> to configure certain properties, null otherwise.</param> <param name="climb_rate">The value to adjust the SpinButton by when one of its arrows are clicked.</param> <param name="digits">The number of decimal places to display.</param> <remarks> <para>An <see cref="T:Gtk.Adjustment" /> is used to configure a variety of the properties for a SpinButton. See the documentation for the <see cref="T:Gtk.Adjustment" /> members for more information.</para> </remarks> </Docs> </Member> <Member MemberName="Update"> <MemberSignature Language="C#" Value="public void Update ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Forces the SpinButton to update its value</summary> <remarks /> </Docs> </Member> <Member MemberName="SetIncrements"> <MemberSignature Language="C#" Value="public void SetIncrements (double step, double page);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="step" Type="System.Double" /> <Parameter Name="page" Type="System.Double" /> </Parameters> <Docs> <summary>Sets the step and page increments.</summary> <param name="step">The amount to change the spin button by when the user clicks with button 1, (usually the left mouse button).</param> <param name="page">The amount to change the spin button by when the user clicks with button 2, (usually the middle mouse button).</param> <remarks> <para>Changing the values with this method alters how quickly the SpinButton's value changes when its arrows are activated.</para> </remarks> </Docs> </Member> <Member MemberName="SetRange"> <MemberSignature Language="C#" Value="public void SetRange (double min, double max);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="min" Type="System.Double" /> <Parameter Name="max" Type="System.Double" /> </Parameters> <Docs> <summary>Alters the minimum and maximum allowable values.</summary> <param name="min">The minimum value that can be entered.</param> <param name="max">The maximum value that can be entered.</param> <remarks /> </Docs> </Member> <Member MemberName="GetIncrements"> <MemberSignature Language="C#" Value="public void GetIncrements (out double step, out double page);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="step" Type="System.Double&" RefType="out" /> <Parameter Name="page" Type="System.Double&" RefType="out" /> </Parameters> <Docs> <summary>Retrieve the current step and page increments.</summary> <param name="step">Outputs the value that a spin button is changed by when the user clicks with button 1, (usually the left mouse button).</param> <param name="page">Outputs the value that a spin button is changed by when the user clicks with button 2, (usually the middle mouse button).</param> <remarks /> </Docs> </Member> <Member MemberName="Finalize"> <MemberSignature Language="C#" Value="protected override void Finalize ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Disposes the resources associated with the object.</summary> <remarks /> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public SpinButton (IntPtr raw);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="raw" Type="System.IntPtr" /> </Parameters> <Docs> <summary>Internal constructor</summary> <param name="raw">Pointer to the C object.</param> <returns>An instance of SpinButton, wrapping the C object.</returns> <remarks> <para>This is an internal constructor, and should not be used by user code.</para> </remarks> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public SpinButton (Gtk.Adjustment adjustment, double climb_rate, uint digits);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="adjustment" Type="Gtk.Adjustment" /> <Parameter Name="climb_rate" Type="System.Double" /> <Parameter Name="digits" Type="System.UInt32" /> </Parameters> <Docs> <summary>Creates a new SpinButton based on the specified <see cref="T:Gtk.Adjustment" />.</summary> <param name="adjustment">To be added: an object of type 'Gtk.Adjustment'</param> <param name="climb_rate">To be added: an object of type 'double'</param> <param name="digits">To be added: an object of type 'uint'</param> <returns>To be added: an object of type 'Gtk.SpinButton'</returns> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public SpinButton (double min, double max, double step);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="min" Type="System.Double" /> <Parameter Name="max" Type="System.Double" /> <Parameter Name="step" Type="System.Double" /> </Parameters> <Docs> <summary>Creates a SpinButton without the need for a manually created <see cref="T:Gtk.Adjustment" />.</summary> <param name="min">Minimum allowable value.</param> <param name="max">Maximum allowable value.</param> <param name="step">The value to alter the SpinButton by when a <see cref="Gtk.SpinButton.Spin" /> is carried out on it.</param> <returns>A new SpinButton.</returns> <remarks> <para>The default value of the new SpinButton is initially set to <paramref name="min" />.</para> <para>The default page increment is set to 10 * <paramref name="step" />.</para> <para>The visible precision of the spin button is equivalent to the precision of <paramref name="step" />.</para> </remarks> </Docs> </Member> <Member MemberName="ValueAsInt"> <MemberSignature Language="C#" Value="public int ValueAsInt { get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Int32</ReturnType> </ReturnValue> <Docs> <summary>Retrieve the current value as an integer.</summary> <returns>The value of the SpinButton with integer precision.</returns> <remarks /> </Docs> </Member> <Member MemberName="Numeric"> <MemberSignature Language="C#" Value="public bool Numeric { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Boolean</ReturnType> </ReturnValue> <Parameters> </Parameters> <Docs> <summary>Manage whether or not the SpinButton accepts non-numeric input.</summary> <param name="value"> <see langword="true" /> if non-numeric text can be entered into the text entry of the SpinButton, <see langword="false" /> otherwise.</param> <returns>Whether the SpinButton currently accepts only numeric input.</returns> <remarks /> </Docs> </Member> <Member MemberName="ClimbRate"> <MemberSignature Language="C#" Value="public double ClimbRate { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Double</ReturnType> </ReturnValue> <Parameters> </Parameters> <Docs> <summary>To be added</summary> <param name="value">To be added: an object of type 'double'</param> <returns>To be added: an object of type 'double'</returns> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Wrap"> <MemberSignature Language="C#" Value="public bool Wrap { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Boolean</ReturnType> </ReturnValue> <Parameters> </Parameters> <Docs> <summary>Manage whether a SpinButton's value wraps around to the opposite limit when the upper or lower limit of the range is exceeded.</summary> <param name="value">Set to <see langword="true" /> to cause values to wrap from maximum to minimum, <see langword="false" /> to force the value at the limits to remain unchanged.</param> <returns>Whether this SpinButton wraps its maximum/minimum values when spinning.</returns> <remarks> <para>If this property is set to <see langword="true" />, 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.</para> <para>Alternatively, if this property is set to <see langword="false" />, 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.</para> </remarks> </Docs> </Member> <Member MemberName="Value"> <MemberSignature Language="C#" Value="public double Value { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Double</ReturnType> </ReturnValue> <Parameters> </Parameters> <Docs> <summary>The current value of the SpinButton.</summary> <param name="value">Sets a new value in this SpinButton</param> <returns>The current value of the SpinButton.</returns> <remarks> <para>The value of the SpinButton is limited by the precision set with the <see cref="P:Gtk.SpinButton.Digits" /> property.</para> </remarks> </Docs> </Member> <Member MemberName="Digits"> <MemberSignature Language="C#" Value="public uint Digits { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.UInt32</ReturnType> </ReturnValue> <Parameters> </Parameters> <Docs> <summary>Manage the precision that this SpinButton's value is displayed with.</summary> <param name="value">The number of digits to be displayed for the spin button's value.</param> <returns>The maximum number of digits that the SpinButton will currently display.</returns> <remarks> <para>Up to 20 digit precision is allowed.</para> </remarks> </Docs> </Member> <Member MemberName="SnapToTicks"> <MemberSignature Language="C#" Value="public bool SnapToTicks { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>System.Boolean</ReturnType> </ReturnValue> <Parameters> </Parameters> <Docs> <summary>Manage whether values are corrected to the nearest step increment when a SpinButton is activated with an invalid value.</summary> <param name="value"> <see langword="true" /> if invalid values should be corrected, <see langword="false" /> otherwise.</param> <returns> <see langword="true" /> if values are snapped to the nearest step, <see langword="false" /> otherwise.</returns> <remarks /> </Docs> </Member> <Member MemberName="UpdatePolicy"> <MemberSignature Language="C#" Value="public Gtk.SpinButtonUpdatePolicy UpdatePolicy { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>Gtk.SpinButtonUpdatePolicy</ReturnType> </ReturnValue> <Parameters> </Parameters> <Docs> <summary>To be added</summary> <param name="value">To be added: an object of type 'Gtk.SpinButtonUpdatePolicy'</param> <returns>To be added: an object of type 'Gtk.SpinButtonUpdatePolicy'</returns> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Adjustment"> <MemberSignature Language="C#" Value="public Gtk.Adjustment Adjustment { set; get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>Gtk.Adjustment</ReturnType> </ReturnValue> <Parameters> </Parameters> <Docs> <summary>To be added</summary> <param name="value">To be added: an object of type 'Gtk.Adjustment'</param> <returns>To be added: an object of type 'Gtk.Adjustment'</returns> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="Output"> <MemberSignature Language="C#" Value="public event Gtk.OutputHandler Output;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>Gtk.OutputHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>To be added</summary> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="ValueChanged"> <MemberSignature Language="C#" Value="public event EventHandler ValueChanged;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>This event is fired when the SpinButton's value changes.</summary> <remarks /> </Docs> </Member> <Member MemberName="Input"> <MemberSignature Language="C#" Value="public event Gtk.InputHandler Input;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>Gtk.InputHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>To be added</summary> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="ChangeValue"> <MemberSignature Language="C#" Value="public event Gtk.ChangeValueHandler ChangeValue;" /> <MemberType>Event</MemberType> <ReturnValue> <ReturnType>Gtk.ChangeValueHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>To be added</summary> <remarks>To be added</remarks> </Docs> </Member> <Member MemberName="GType"> <MemberSignature Language="C#" Value="public static GLib.GType GType { get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>GLib.GType</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>GType Property.</summary> <returns>a <see cref="T:GLib.GType" /></returns> <remarks>Returns the native <see cref="T:GLib.GType" /> value for <see cref="T:Gtk.SpinButton" />.</remarks> </Docs> </Member> <Member MemberName="OnChangeValue"> <MemberSignature Language="C#" Value="protected virtual void OnChangeValue (Gtk.ScrollType scroll);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters> <Parameter Name="scroll" Type="Gtk.ScrollType" /> </Parameters> <Docs> <summary>Default handler for the <see cref="M:Gtk.SpinButton.ChangeValue" /> event.</summary> <param name="scroll">a <see cref="T:Gtk.ScrollType" /></param> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.SpinButton.ChangeValue" /> event.</remarks> </Docs> </Member> <Member MemberName="OnInput"> <MemberSignature Language="C#" Value="protected virtual int OnInput (out double new_value);" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Int32</ReturnType> </ReturnValue> <Parameters> <Parameter Name="new_value" Type="System.Double&" RefType="out" /> </Parameters> <Docs> <summary>Default handler for the <see cref="M:Gtk.SpinButton.Input" /> event.</summary> <param name="new_value">a <see cref="T:System.Double&" /></param> <returns>a <see cref="T:System.Int32" /></returns> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.SpinButton.Input" /> event.</remarks> </Docs> </Member> <Member MemberName="OnValueChanged"> <MemberSignature Language="C#" Value="protected virtual void OnValueChanged ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Default handler for the <see cref="M:Gtk.SpinButton.ValueChanged" /> event.</summary> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.SpinButton.ValueChanged" /> event.</remarks> </Docs> </Member> <Member MemberName="OnOutput"> <MemberSignature Language="C#" Value="protected virtual int OnOutput ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Int32</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Default handler for the <see cref="M:Gtk.SpinButton.Output" /> event.</summary> <returns>a <see cref="T:System.Int32" /></returns> <remarks>Override this method in a subclass to provide a default handler for the <see cref="M:Gtk.SpinButton.Output" /> event.</remarks> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="protected SpinButton (GLib.GType gtype);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="gtype" Type="GLib.GType" /> </Parameters> <Docs> <summary>Protected Constructor.</summary> <param name="gtype">a <see cref="T:GLib.GType" /></param> <returns>a <see cref="T:Gtk.SpinButton" /></returns> <remarks>Chain to this constructor if you have manually registered a native <see cref="T:GLib.GType" /> value for your subclass.</remarks> </Docs> </Member> </Members> </Type>