SpinGadget()

Syntax

Result = SpinGadget(#Gadget, x, y, Width, Height, Minimum, Maximum)
Description
Creates a spin gadget in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget identifier will be returned as 'Result'. #Gadget will be the numeric identifier returned by EventGadgetID() command.

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.

Example:
  If OpenWindow(0,0,0,140,70,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"SpinGadget") 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 EventGadgetID() = 0
        SetGadgetText(0,Str(GetGadgetState(0)))
        WindowEvent()      ; absolutely needed to avoid endless event-loops
      EndIf
    Until Event = #PB_Event_CloseWindow
  EndIf

Supported OS

Windows, Linux, MacOS X

<- SetGadgetText() - Gadget Index - SplitterGadget() ->