SpinGadget()
Syntax
Result = SpinGadget(#Gadget, x, y, Width, Height, Minimum, Maximum [, Flags])Description
Creates a spin gadget in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget number will be returned as 'Result'. #Gadget will be the number returned by EventGadget() command.
'Flags' is an optional parameter and can be composed of one of the following constants:#PB_Spin_ReadOnly : The StringGadget is not editable, the number is only changeable by the arrows #PB_Spin_Numeric : The SpinGadget will automatically update the text with value of the state, so SetGadgetText is not needed.You can add a 'mini help' to this gadget by using GadgetToolTip().
The following commands can be used to act on a SpinGadget:
GetGadgetState(): Get the current gadget value.
SetGadgetState(): Change the gadget value. For displaying the new value you still must use SetGadgetText()!
GetGadgetText(): Get the text contained in the gadget.
SetGadgetText(): Change the text contained in the gadget.
GetGadgetAttribute(): With one of the following attributes:#PB_Spin_Minimum : Returns the minimum value. #PB_Spin_Maximum : Returns the maximum value.SetGadgetAttribute(): With one of the following attributes:#PB_Spin_Minimum : Changes the minimum value. #PB_Spin_Maximum : Changes the maximum value.The following events are supported through EventType():#PB_EventType_Change: The text in the edit area has been modified by the user. 1: The 'Up' button was pressed. -1: The 'Down' button was pressed.This gadget supports the SetGadgetColor() and GetGadgetColor() commands with the following values as 'ColorType':#PB_Gadget_FrontColor: Textcolor #PB_Gadget_BackColor : Backgroundcolor
Example:If OpenWindow(0, 0, 0, 140, 70, "SpinGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0)) SpinGadget (0, 20, 20, 100, 25, 0, 1000) SetGadgetState (0, 5) : SetGadgetText(0, "5") ; set initial value Repeat Event = WaitWindowEvent() If Event = #PB_Event_Gadget If EventGadget() = 0 SetGadgetText(0,Str(GetGadgetState(0))) EndIf EndIf Until Event = #PB_Event_CloseWindow EndIf
Supported OS
All