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 number 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 number returned by EventGadget() command. When the user moves the scrollbars in the gadget, an event will be received for the gadget.
'Flags' are optional 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 #PB_ScrollArea_Center : If the inner size is smaller than the outer, the inner area is automatically centered.
The following commands 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. #PB_ScrollArea_X : Returns the current horizontal scrolling position (in pixels). #PB_ScrollArea_Y : Returns the current vertical scrolling position (in pixels).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. #PB_ScrollArea_X : Changes the current horizontal scrolling position (in pixels). #PB_ScrollArea_Y : Changes the current vertical scrolling position (in pixels).This gadget supports the SetGadgetColor() and GetGadgetColor() commands with the #PB_Gadget_BackColor type to change the background color.
Example:If OpenWindow(0, 0, 0, 305, 140, "ScrollAreaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 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 EventGadget() 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
All