Syntax
Layout = WindowGetLayout(Window, LayoutType=#PG_Window_LayoutType_Client)Description
Retrieves the handle to a layout container
associated with the specified ProGUI window. Depending on the window
type (skinned or OS system window) and the
LayoutType parameter, this can return the client area
layout, the main container layout, or the absolute root layout.
Parameters
Window
The handle of the ProGUI window whose layout is to be retrieved.
LayoutType (optional)
Specifies which layout hierarchy to retrieve. Default is
#PG_Window_LayoutType_Client. Can be one of the following
constants:
#PG_Window_LayoutType_Client : Retrieves the layout of the window's client area widget. This is the primary layout where custom user interface widgets should be added.
#PG_Window_LayoutType_Container : Retrieves the layout of the window's main container widget (which typically holds the title bar, borders, and the client area).
#PG_Window_LayoutType_Root : Retrieves the window's absolute root layout.
Return Value
Returns the handle to the requested layout object if the window
handle is valid. Returns #Null or #False on
error.
Remarks
Every ProGUI window automatically has a layout hierarchy created for it upon window creation.
By default, ProGUI creates custom skinned
windows. For skinned windows, it’s highly recommended to use the default
#PG_Window_LayoutType_Client to add your UI widgets so that
they are placed properly underneath the custom title bar and within the
window borders.
If the window was created as a native OS system window (using the
#PG_Window_System flag in CreateWindow()), it only possesses a single
root layout. In this case, WindowGetLayout() will always
return the root layout regardless of the LayoutType
parameter specified.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
; Create a standard skinned window
MyWindow = CreateWindow(0, 0, 500, 400, "Window Layout Example")
If MyWindow
; Get the client layout (default) to add our main UI elements
ClientLayout = WindowGetLayout(MyWindow)
If ClientLayout
; Set the client layout to Flexbox
LayoutSetType(ClientLayout, #PG_Layout_Type_Flex)
LayoutFlexSetDirection(ClientLayout, #PG_Flex_Direction_Column)
LayoutSetPadding(ClientLayout, 20) ; Add padding
; Add a widget to the client layout
MyWidget = CreateWidget(0, 0, 100, 30)
WidgetSetClass(MyWidget, "button") ; Assume a skin defines "button"
WidgetSetMargin(MyWidget, 10)
; ... further widget setup ...
EndIf
WindowShow(MyWindow, #True, #PG_WindowShow_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()See Also
CreateWindow, LayoutSetType, WindowSetLayout
Supported OS
Windows, Linux