ScrollAreaGadget()

Syntax

Result = ScrollAreaGadget(#Gadget, x, y, Width, Height, ScrollAreaWidth, ScrollAreaHeight, ScrollStep [, Flags])
Description
Creates a ScrollArea gadget in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget identifier will be returned as 'Result'. It's very useful when a gadget is too big to fit the window dimension. In that case, it can be put into a scrollarea. All the scrolling is handled automatically by the gadget. This is a container gadget, intended to have one or several gadget in its scroll area. Once the gadget is created, all future created gadgets will be created inside the scoll area. When all the needed gadgets have been created, CloseGadgetList() must be called to return to the previous GadgetList. OpenGadgetList() can be used later to add others gadgets on the fly in the scroll area.

'ScrollAreaWidth' and 'ScrollAreaHeight' are the initial dimensions of the scrollable area contained inside the gadget and should be greater than the gadget's 'Width' and 'Height' dimensions. 'ScrollStep' is the number of pixels scrolled when pressing a slider arrow. #Gadget will be the numeric identifier returned by EventGadgetID() command. The following command can be used to act on a ScrollAreaGadget:

GetGadgetAttribute(): With one of the following attribute:
  #PB_ScrollArea_InnerWidth  : Returns the width (in pixels) of the contained scrollable area. 
  #PB_ScrollArea_InnerHeight : Returns the height (in pixels) of the contained scrollable area.  
SetGadgetAttribute(): With one of the following attribute:
  #PB_ScrollArea_InnerWidth  : Changes the width (in pixels) of the contained scrollable area. 
  #PB_ScrollArea_InnerHeight : Changes the height (in pixels) of the contained scrollable area.  
'Flags' are optionals and can be composed of one of the following constants:
  #PB_ScrollArea_Flat       : Flat frame
  #PB_ScrollArea_Raised     : Raised frame
  #PB_ScrollArea_Single     : Single sunken frame
  #PB_ScrollArea_BorderLess : Without any border
Example:
  If OpenWindow(0,0,0,305,140,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"ScrollAreaGadget") And CreateGadgetList(WindowID(0))
    ScrollAreaGadget(0, 10, 10,290,120, 375, 155, 30)
      ButtonGadget  (1, 10, 10,230, 30,"Button 1")
      ButtonGadget  (2, 50, 50,230, 30,"Button 2")
      ButtonGadget  (3, 90, 90,230, 30,"Button 3")
      TextGadget    (4,130,130,230, 20,"This is the content of a ScrollAreaGadget!",#PB_Text_Right)
      CloseGadgetList() 
    Repeat 
      Select WaitWindowEvent() 
        Case  #PB_Event_CloseWindow 
          End 
        Case  #PB_Event_Gadget 
          Select EventGadgetID()
            Case 1
              MessageRequester("Info","Button 1 was pressed!",#PB_MessageRequester_Ok)
            Case 2
              MessageRequester("Info","Button 2 was pressed!",#PB_MessageRequester_Ok)
            Case 3
              MessageRequester("Info","Button 3 was pressed!",#PB_MessageRequester_Ok)
          EndSelect
      EndSelect 
    ForEver 
  EndIf

Supported OS

Windows, Linux, MacOS X

<- ResizeGadget() - Gadget Index - ScrollBarGadget() ->