Syntax
Success = LayoutFlexSetAlignContent(Layout, AlignContent)
Description
Sets how lines are distributed along the cross axis when items wrap in a Flexbox layout container. This property only has an effect when LayoutFlexSetWrap() is enabled and there are multiple lines of items. It's analogous to the `align-content` property in CSS Flexbox.
Parameters
Layout
The handle of the Flexbox layout object. If #Null, it targets the current layout.
AlignContent
The content alignment constant.
#PG_Flex_AlignContent_Start : Lines are packed toward the start of the cross axis. (Default)
#PG_Flex_AlignContent_Center : Lines are centered along the cross axis.
#PG_Flex_AlignContent_End : Lines are packed toward the end of the cross axis.
#PG_Flex_AlignContent_SpaceAround : Lines are evenly distributed with space around them (half-size space at ends).
#PG_Flex_AlignContent_SpaceBetween : Lines are evenly distributed; first line at the start, last line at the end.
#PG_Flex_AlignContent_Stretch : Lines stretch to take up the remaining space along the cross axis.
Return Value
Returns #True if the alignment mode was successfully set, or #False if the layout handle or alignment constant was invalid.
Remarks
This property only applies to layouts whose type is #PG_Layout_Type_Flex and where #PG_Flex_Wrap_Enabled is set. It controls the spacing *between* wrapped lines, whereas LayoutFlexSetAlignItems() controls the alignment of items *within* a single line.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
MyWindow = CreateWindow(0, 0, 250, 300, "Flex Align Content") ; 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)
; Distribute the wrapped lines with space around them
LayoutFlexSetAlignContent(RootLayout, #PG_Flex_AlignContent_SpaceAround)
; Add several widgets that will likely wrap
For i = 1 To 8
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, LayoutFlexGetAlignContent, LayoutFlexSetWrap, LayoutFlexSetAlignItems
Supported OS
Windows, Linux