Syntax
Success = LayoutFlexSetWrap(Layout, Wrap)
Description
Enables or disables wrapping for a Flexbox layout container. When enabled, items that overflow the container along the main axis will wrap onto the next line.
Parameters
Layout
The handle of the Flexbox layout object. If #Null, it targets the current layout.
Wrap
The wrapping constant.
#PG_Flex_Wrap_None : Items will not wrap and may overflow. (Default)
#PG_Flex_Wrap_Enabled : Items will wrap onto new lines if they overflow.
Return Value
Returns #True if the wrap mode was successfully set, or #False if the layout handle or wrap constant was invalid.
Remarks
This property only applies to layouts whose type is #PG_Layout_Type_Flex. Wrapping behavior interacts with the flex direction and item sizes. When wrapping is enabled, LayoutFlexSetAlignContent() can be used to control the alignment of the wrapped lines.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
MyWindow = CreateWindow(0, 0, 250, 300, "Flex Wrap") ; Window is narrow
If MyWindow
RootLayout = WindowGetLayout(MyWindow)
LayoutSetType(RootLayout, #PG_Layout_Type_Flex)
LayoutSetPadding(RootLayout, 10)
LayoutFlexSetDirection(RootLayout, #PG_Flex_Direction_Row) ; Lay out in a row
; Enable wrapping
LayoutFlexSetWrap(RootLayout, #PG_Flex_Wrap_Enabled)
LayoutFlexSetAlignContent(RootLayout, #PG_Flex_AlignContent_SpaceAround) ; Distribute wrapped lines
; Add several widgets that will likely overflow the narrow window width
For i = 1 To 6
widget = CreateWidget(0, 0, 80, 40)
WidgetSetMargin(widget, 5)
Next
WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()
See Also
LayoutSetType, LayoutFlexGetWrap, LayoutFlexSetDirection, LayoutFlexSetAlignContent
Supported OS
Windows, Linux