ScrollBarGadget()

Syntax

Result = ScrollBarGadget(#Gadget, x, y, Width, Height, Minimum, Maximum, PageLength [, Flags])
Description
Creates a scrollbar gadget in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget number will be returned as 'Result'. It's widely used when displaying only a part of an object. The Minimum-Maximum range should be between 0 and 10,000. The 'PageLength' is the number which defines a page. For example you can have a picture which is 100 pixels width and you only see 25 pixels. What you see is a called a 'page', in this example, the page length will be 25, the Mininum will be 0 and the Maximum will be 100. #Gadget will be the number returned by EventGadget() command.

'Flags' are optionals and can be composed of one of the following constants:
  #PB_ScrollBar_Vertical : The scrollbar is vertical (instead of horizontal, which is the default).
You can add a 'mini help' to this gadget by using GadgetToolTip().

The following commands can be used to act on this gadget:

- GetGadgetState(): Returns the current slider position (value between the Minimum-Maximum range).
- SetGadgetState(): Changes the current slider position.
- GetGadgetAttribute(): With one of the following attributes:
  #PB_ScrollBar_Minimum   : Returns the minimum scroll position.
  #PB_ScrollBar_Maximum   : Returns the maximum scroll position. 
  #PB_ScrollBar_PageLength: Returns the PageLength value. 
- SetGadgetAttribute(): With one of the following attributes:
  #PB_ScrollBar_Minimum   : Changes the minimum scroll position.
  #PB_ScrollBar_Maximum   : Changes the maximum scroll position. 
  #PB_ScrollBar_PageLength: Changes the PageLength value.

Example:
  If OpenWindow(0, 0, 0, 305, 140, "ScrollBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    TextGadget       (2,  10, 25, 250,  20, "ScrollBar Standard  (start=50, page=30/100)",#PB_Text_Center)
    ScrollBarGadget  (0,  10, 42, 250,  20, 0, 100, 30)
    SetGadgetState   (0,  50)   ; set 1st scrollbar (ID = 0) to 50 of 100
    TextGadget       (3,  10,115, 250,  20, "ScrollBar Vertical  (start=100, page=50/300)",#PB_Text_Right)
    ScrollBarGadget  (1, 270, 10,  25, 120 ,0, 300, 50, #PB_ScrollBar_Vertical)
    SetGadgetState   (1, 100)   ; set 2nd scrollbar (ID = 1) to 100 of 300
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Supported OS

All

<- ScrollAreaGadget() - Gadget Index - SetActiveGadget() ->