Index

Package: Spin_Button

Description

package Gtk.Spin_Button is

A Gtk_Spin_Button is a single line text editing widget for text that represents a number. At the right hand side of the text line there are small up- and down arrow buttons for incrementing or decrementing (spinning) the number within a given range.

It allows the value to have zero or a number of decimal places and to be incremented/decremented in configurable steps.

The action of holding down one of the buttons optionally results in an acceleration of change in the value according to how long it is depressed.

See Gtk.GEntry for a text editing widget without spin buttons.

Binding from C File version 2.8.17

Screenshot

gtk-spin_button.png
<testgtk>create_spin.adb</testgtk>

Packages

Spin_Button_Update_Policy_Properties (new Glib.Generic_Properties.Generic_Internal_Discrete_Property)

Classes

Gtk_Spin_Button_Record

type Gtk_Spin_Button_Record is new Gtk.GEntry.Gtk_Entry_Record with private;

Ancestors:

Primitive operations:

Get_Adjustment
Get_Increments
Get_Snap_To_Ticks
Get_Update_Policy
Get_Value_As_Int
Glib.Object.Deallocate (Inherited)
Glib.Object.Get_Type (Inherited)
Glib.Object.Notify (Inherited)
Glib.Object.Ref (Inherited)
Glib.Object.Ref_Sink (Inherited)
Glib.Object.Unref (Inherited)
Gtk.Editable.Copy_Clipboard (Inherited)
Gtk.Editable.Cut_Clipboard (Inherited)
Gtk.Editable.Delete_Selection (Inherited)
Gtk.Editable.Delete_Text (Inherited)
Gtk.Editable.Get_Chars (Inherited)
Gtk.Editable.Get_Editable (Inherited)
Gtk.Editable.Get_Position (Inherited)
Gtk.Editable.Get_Selection_Bounds (Inherited)
Gtk.Editable.Insert_Text (Inherited)
Gtk.Editable.Paste_Clipboard (Inherited)
Gtk.Editable.Select_Region (Inherited)
Gtk.Editable.Set_Editable (Inherited)
Gtk.Editable.Set_Position (Inherited)
Gtk.GEntry.Append_Text (Inherited)
Gtk.GEntry.Get_Activates_Default (Inherited)
Gtk.GEntry.Get_Alignment (Inherited)
Gtk.GEntry.Get_Completion (Inherited)
Gtk.GEntry.Get_Current_Icon_Drag_Source (Inherited)
Gtk.GEntry.Get_Cursor_Hadjustment (Inherited)
Gtk.GEntry.Get_Has_Frame (Inherited)
Gtk.GEntry.Get_Icon_Activatable (Inherited)
Gtk.GEntry.Get_Icon_At_Pos (Inherited)
Gtk.GEntry.Get_Icon_Gicon (Inherited)
Gtk.GEntry.Get_Icon_Name (Inherited)
Gtk.GEntry.Get_Icon_Pixbuf (Inherited)
Gtk.GEntry.Get_Icon_Sensitive (Inherited)
Gtk.GEntry.Get_Icon_Stock (Inherited)
Gtk.GEntry.Get_Icon_Storage_Type (Inherited)
Gtk.GEntry.Get_Icon_Tooltip_Markup (Inherited)
Gtk.GEntry.Get_Icon_Tooltip_Text (Inherited)
Gtk.GEntry.Get_Inner_Border (Inherited)
Gtk.GEntry.Get_Invisible_Char (Inherited)
Gtk.GEntry.Get_Layout (Inherited)
Gtk.GEntry.Get_Layout_Offsets (Inherited)
Gtk.GEntry.Get_Max_Length (Inherited)
Gtk.GEntry.Get_Overwrite_Mode (Inherited)
Gtk.GEntry.Get_Progress_Fraction (Inherited)
Gtk.GEntry.Get_Progress_Pulse_Step (Inherited)
Gtk.GEntry.Get_Text (Inherited)
Gtk.GEntry.Get_Text_Length (Inherited)
Gtk.GEntry.Get_Visibility (Inherited)
Gtk.GEntry.Layout_Index_To_Text_Index (Inherited)
Gtk.GEntry.Prepend_Text (Inherited)
Gtk.GEntry.Progress_Pulse (Inherited)
Gtk.GEntry.Set_Activates_Default (Inherited)
Gtk.GEntry.Set_Alignment (Inherited)
Gtk.GEntry.Set_Completion (Inherited)
Gtk.GEntry.Set_Cursor_Hadjustment (Inherited)
Gtk.GEntry.Set_Editable (Inherited)
Gtk.GEntry.Set_Has_Frame (Inherited)
Gtk.GEntry.Set_Icon_Activatable (Inherited)
Gtk.GEntry.Set_Icon_Drag_Source (Inherited)
Gtk.GEntry.Set_Icon_From_Gicon (Inherited)
Gtk.GEntry.Set_Icon_From_Icon_Name (Inherited)
Gtk.GEntry.Set_Icon_From_Pixbuf (Inherited)
Gtk.GEntry.Set_Icon_From_Stock (Inherited)
Gtk.GEntry.Set_Icon_Sensitive (Inherited)
Gtk.GEntry.Set_Icon_Tooltip_Markup (Inherited)
Gtk.GEntry.Set_Icon_Tooltip_Text (Inherited)
Gtk.GEntry.Set_Inner_Border (Inherited)
Gtk.GEntry.Set_Invisible_Char (Inherited)
Gtk.GEntry.Set_Max_Length (Inherited)
Gtk.GEntry.Set_Overwrite_Mode (Inherited)
Gtk.GEntry.Set_Progress_Fraction (Inherited)
Gtk.GEntry.Set_Progress_Pulse_Step (Inherited)
Gtk.GEntry.Set_Text (Inherited)
Gtk.GEntry.Set_Visibility (Inherited)
Gtk.GEntry.Text_Index_To_Layout_Index (Inherited)
Gtk.GEntry.Unset_Invisible_Char (Inherited)
Gtk.Widget.Activate (Inherited)
Gtk.Widget.Add_Accelerator (Inherited)
Gtk.Widget.Add_Events (Inherited)
Gtk.Widget.Add_Mnemonic_Label (Inherited)
Gtk.Widget.Can_Activate_Accel (Inherited)
Gtk.Widget.Child_Notify (Inherited)
Gtk.Widget.Class_Path (Inherited)
Gtk.Widget.Class_Path_Reversed (Inherited)
Gtk.Widget.Create_Pango_Context (Inherited)
Gtk.Widget.Create_Pango_Layout (Inherited)
Gtk.Widget.Destroy (Inherited)
Gtk.Widget.Draw (Inherited)
Gtk.Widget.Ensure_Style (Inherited)
Gtk.Widget.Error_Bell (Inherited)
Gtk.Widget.Flag_Is_Set (Inherited)
Gtk.Widget.Flags (Inherited)
Gtk.Widget.Freeze_Child_Notify (Inherited)
Gtk.Widget.Get_Allocation_Height (Inherited)
Gtk.Widget.Get_Allocation_Width (Inherited)
Gtk.Widget.Get_Allocation_X (Inherited)
Gtk.Widget.Get_Allocation_Y (Inherited)
Gtk.Widget.Get_Ancestor (Inherited)
Gtk.Widget.Get_Child_Requisition (Inherited)
Gtk.Widget.Get_Child_Visible (Inherited)
Gtk.Widget.Get_Colormap (Inherited)
Gtk.Widget.Get_Composite_Name (Inherited)
Gtk.Widget.Get_Direction (Inherited)
Gtk.Widget.Get_Events (Inherited)
Gtk.Widget.Get_Extension_Events (Inherited)
Gtk.Widget.Get_Has_Tooltip (Inherited)
Gtk.Widget.Get_Name (Inherited)
Gtk.Widget.Get_No_Show_All (Inherited)
Gtk.Widget.Get_Pango_Context (Inherited)
Gtk.Widget.Get_Parent (Inherited)
Gtk.Widget.Get_Parent_Window (Inherited)
Gtk.Widget.Get_Pointer (Inherited)
Gtk.Widget.Get_Root_Window (Inherited)
Gtk.Widget.Get_Size_Request (Inherited)
Gtk.Widget.Get_Snapshot (Inherited)
Gtk.Widget.Get_State (Inherited)
Gtk.Widget.Get_Style (Inherited)
Gtk.Widget.Get_Tooltip_Markup (Inherited)
Gtk.Widget.Get_Tooltip_Text (Inherited)
Gtk.Widget.Get_Tooltip_Window (Inherited)
Gtk.Widget.Get_Toplevel (Inherited)
Gtk.Widget.Get_Visual (Inherited)
Gtk.Widget.Get_Window (Inherited)
Gtk.Widget.Grab_Default (Inherited)
Gtk.Widget.Grab_Focus (Inherited)
Gtk.Widget.Has_Screen (Inherited)
Gtk.Widget.Hide (Inherited)
Gtk.Widget.Hide_All (Inherited)
Gtk.Widget.Input_Shape_Combine_Mask (Inherited)
Gtk.Widget.Intersect (Inherited)
Gtk.Widget.Is_Ancestor (Inherited)
Gtk.Widget.Is_Composited (Inherited)
Gtk.Widget.Is_Focus (Inherited)
Gtk.Widget.Keynav_Failed (Inherited)
Gtk.Widget.List_Mnemonic_Labels (Inherited)
Gtk.Widget.Map (Inherited)
Gtk.Widget.Mnemonic_Activate (Inherited)
Gtk.Widget.Modify_Base (Inherited)
Gtk.Widget.Modify_Bg (Inherited)
Gtk.Widget.Modify_Cursor (Inherited)
Gtk.Widget.Modify_Fg (Inherited)
Gtk.Widget.Modify_Font (Inherited)
Gtk.Widget.Modify_Text (Inherited)
Gtk.Widget.Path (Inherited)
Gtk.Widget.Path_Reversed (Inherited)
Gtk.Widget.Queue_Clear (Inherited)
Gtk.Widget.Queue_Clear_Area (Inherited)
Gtk.Widget.Queue_Draw (Inherited)
Gtk.Widget.Queue_Draw_Area (Inherited)
Gtk.Widget.Queue_Resize (Inherited)
Gtk.Widget.Queue_Resize_No_Redraw (Inherited)
Gtk.Widget.Realize (Inherited)
Gtk.Widget.Region_Intersect (Inherited)
Gtk.Widget.Remove_Accelerator (Inherited)
Gtk.Widget.Remove_Mnemonic_Label (Inherited)
Gtk.Widget.Render_Icon (Inherited)
Gtk.Widget.Reparent (Inherited)
Gtk.Widget.Reset_Rc_Styles (Inherited)
Gtk.Widget.Reset_Shapes (Inherited)
Gtk.Widget.Restore_Default_Style (Inherited)
Gtk.Widget.Send_Expose (Inherited)
Gtk.Widget.Set_Accel_Path (Inherited)
Gtk.Widget.Set_App_Paintable (Inherited)
Gtk.Widget.Set_Child_Visible (Inherited)
Gtk.Widget.Set_Colormap (Inherited)
Gtk.Widget.Set_Composite_Name (Inherited)
Gtk.Widget.Set_Direction (Inherited)
Gtk.Widget.Set_Double_Buffered (Inherited)
Gtk.Widget.Set_Events (Inherited)
Gtk.Widget.Set_Extension_Events (Inherited)
Gtk.Widget.Set_Flags (Inherited)
Gtk.Widget.Set_Has_Tooltip (Inherited)
Gtk.Widget.Set_Name (Inherited)
Gtk.Widget.Set_No_Show_All (Inherited)
Gtk.Widget.Set_Parent (Inherited)
Gtk.Widget.Set_Parent_Window (Inherited)
Gtk.Widget.Set_Redraw_On_Allocate (Inherited)
Gtk.Widget.Set_Scroll_Adjustments (Inherited)
Gtk.Widget.Set_Sensitive (Inherited)
Gtk.Widget.Set_Size_Request (Inherited)
Gtk.Widget.Set_State (Inherited)
Gtk.Widget.Set_Style (Inherited)
Gtk.Widget.Set_Tooltip_Markup (Inherited)
Gtk.Widget.Set_Tooltip_Text (Inherited)
Gtk.Widget.Set_Tooltip_Window (Inherited)
Gtk.Widget.Set_UPosition (Inherited)
Gtk.Widget.Set_USize (Inherited)
Gtk.Widget.Set_Window (Inherited)
Gtk.Widget.Shape_Combine_Mask (Inherited)
Gtk.Widget.Show (Inherited)
Gtk.Widget.Show_All (Inherited)
Gtk.Widget.Show_Now (Inherited)
Gtk.Widget.Size_Allocate (Inherited)
Gtk.Widget.Size_Request (Inherited)
Gtk.Widget.Style_Get_Property (Inherited)
Gtk.Widget.Thaw_Child_Notify (Inherited)
Gtk.Widget.Trigger_Tooltip_Query (Inherited)
Gtk.Widget.Unmap (Inherited)
Gtk.Widget.Unrealize (Inherited)
Gtk.Widget.Unset_Flags (Inherited)
Set_Adjustment
Set_Increments
Set_Snap_To_Ticks
Set_Update_Policy

Types

Gtk_Spin_Button

type Gtk_Spin_Button is access all Gtk_Spin_Button_Record'Class;

Gtk_Spin_Button_Update_Policy

type Gtk_Spin_Button_Update_Policy is
     (Update_Always,
      --  Update always, errors are ignored while converting text into a
      --  numeric value.

      Update_If_Valid
      --  The spin button's value gets changed if the text input is a numeric
      --  value that is within the range specified by the adjustment.
     );

Gtk_Spin_Type

type Gtk_Spin_Type is
     (Spin_Step_Forward,
      Spin_Step_Backward,
      Spin_Page_Forward,
      Spin_Page_Backward,
      Spin_Home,
      Spin_End,
      Spin_User_Defined);
Determine how manual spinning should be done. See also the Spin procedure.

Property_Spin_Button_Update_Policy_Type

type Property_Spin_Button_Update_Policy_Type is new
     Spin_Button_Update_Policy_Properties.Property;

Constants & Global variables

Snap_To_Ticks_Property (Glib.Properties.Property_Boolean)

Snap_To_Ticks_Property : constant Glib.Properties.Property_Boolean;

Signal_Change_Value (Glib.Signal_Name)

Signal_Change_Value  : constant Glib.Signal_Name := "change_value";

Signal_Input (Glib.Signal_Name)

Signal_Input         : constant Glib.Signal_Name := "input";

Signal_Output (Glib.Signal_Name)

Signal_Output        : constant Glib.Signal_Name := "output";

Signal_Value_Changed (Glib.Signal_Name)

Signal_Value_Changed : constant Glib.Signal_Name := "value_changed";

Subprograms & Entries

Gtk_New

procedure Gtk_New 
(Spin_Button: out Gtk_Spin_Button;
Adjustment: Gtk.Adjustment.Gtk_Adjustment;
Climb_Rate: Gdouble;
The_Digits: Gint);
Create a spin button with the given parameters. Adjustment contains the range, current value, step value and "page" value. The step value is the increment/decrement when pressing mouse button 1 on a button; the page value when mouse button 2 is pressed. Additionally, mouse button 3 can be used to jump directly to the or lower values when used to select one of the buttons. Climb_Rate takes a value between 0.0 and 1.0 and indicates the amount of acceleration that the Spin Button has. The_Digits is the number of digits behind the decimal point to be displayed for the value.

Gtk_New

procedure Gtk_New 
(Spin_Button: out Gtk_Spin_Button;
Min: Gdouble;
Max: Gdouble;
Step: Gdouble);
Same as above, but with explicit range instead of an adjustment. The adjustment associated with Spin_Button is created internally.

Initialize

procedure Initialize 
(Spin_Button: access Gtk_Spin_Button_Record'Class;
Adjustment: Gtk.Adjustment.Gtk_Adjustment;
Climb_Rate: Gdouble;
The_Digits: Gint);
Internal initialization function. See the section "Creating your own widgets" in the documentation.

Initialize

procedure Initialize 
(Spin_Button: access Gtk_Spin_Button_Record'Class;
Min: Gdouble;
Max: Gdouble;
Step: Gdouble);
Internal initialization function.

Get_Type

function Get_Type return Gtk.Gtk_Type;
Return the internal value associated with a Gtk_Spin_Button.

Set_Adjustment

procedure Set_Adjustment 
(Spin_Button: access Gtk_Spin_Button_Record;
Adjustment: Gtk.Adjustment.Gtk_Adjustment);

Get_Adjustment

function Get_Adjustment 
(Spin_Button: access Gtk_Spin_Button_Record) return Gtk.Adjustment.Gtk_Adjustment;
Set or Get the adjustment settings of the spin button.

Set_Digits

procedure Set_Digits 
(Spin_Button: access Gtk_Spin_Button_Record;
The_Digits: Guint);

Get_Digits

function Get_Digits 
(Spin_Button: access Gtk_Spin_Button_Record) return Guint;
Set or Get number of decimals of the spin button.

Set_Increments

procedure Set_Increments 
(Spin_Button: access Gtk_Spin_Button_Record;
Step: Gdouble;
Page: Gdouble);

Get_Increments

procedure Get_Increments 
(Spin_Button: access Gtk_Spin_Button_Record;
Step: out Gdouble;
Page: out Gdouble);
Set or Get the increments for a single step and a page move.

Set_Range

procedure Set_Range 
(Spin_Button: access Gtk_Spin_Button_Record;
Min: Gdouble;
Max: Gdouble);

Get_Range

procedure Get_Range 
(Spin_Button: access Gtk_Spin_Button_Record;
Min: out Gdouble;
Max: out Gdouble);
Set or Get range of the spin button.

Set_Value

procedure Set_Value 
(Spin_Button: access Gtk_Spin_Button_Record;
Value: Gdouble);

Get_Value

function Get_Value 
(Spin_Button: access Gtk_Spin_Button_Record) return Gdouble;
Set or Get the current value of the spin button in a double.

Get_Value_As_Int

function Get_Value_As_Int 
(Spin_Button: access Gtk_Spin_Button_Record) return Gint;
Return the current value of the spin button in an integer.

Set_Update_Policy

procedure Set_Update_Policy 
(Spin_Button: access Gtk_Spin_Button_Record;
Policy: Gtk_Spin_Button_Update_Policy);

Get_Update_Policy

function Get_Update_Policy 
(Spin_Button: access Gtk_Spin_Button_Record) return Gtk_Spin_Button_Update_Policy;
Set the update policy of the spin button. See Gtk_Spin_Button_Update_Policy for the meaning of Policy.

Set_Numeric

procedure Set_Numeric 
(Spin_Button: access Gtk_Spin_Button_Record;
Numeric: Boolean);

Get_Numeric

function Get_Numeric 
(Spin_Button: access Gtk_Spin_Button_Record) return Boolean;
If Numeric is True, then only a numeric value can be typed in the text entry, otherwise also nonnumeric text.

Spin

procedure Spin 
(Spin_Button: access Gtk_Spin_Button_Record;
Direction: Gtk_Spin_Type;
Step: Gdouble);
Set the value of the spin button relative to its current value. Depending on Direction, it will be incremented or decremented with the step value.

Set_Wrap

procedure Set_Wrap 
(Spin_Button: access Gtk_Spin_Button_Record;
Wrap: Boolean);

Get_Wrap

function Get_Wrap 
(Spin_Button: access Gtk_Spin_Button_Record) return Boolean;
Set whether the spin button should "wrap around" when exceeding the upper and lower limits.

Set_Snap_To_Ticks

procedure Set_Snap_To_Ticks 
(Spin_Button: access Gtk_Spin_Button_Record;
Snap_To_Ticks: Boolean);

Get_Snap_To_Ticks

function Get_Snap_To_Ticks 
(Spin_Button: access Gtk_Spin_Button_Record) return Boolean;
Set the spin button to round the value to the nearest step value which is set within its adjustment settings.

Update

procedure Update 
(Spin_Button: access Gtk_Spin_Button_Record);
Manually force an update of the spin button.