Syntax
Success = LayoutGridSetJustifyContent(Layout, JustifyContent)Description
Sets how the entire grid structure is aligned horizontally within the layout container, especially when the total width of the grid columns (plus gaps) is less than the container's width. This is analogous to the `justify-content` property in CSS Grid.
Parameters
Layout
The handle of the Grid layout object. If #Null, it targets
the current layout.
JustifyContent
The content justification constant.
#PG_Grid_JustifyContent_Start : Grid is packed toward the start (left). (Default)
#PG_Grid_JustifyContent_Center : Grid is centered horizontally.
#PG_Grid_JustifyContent_End : Grid is packed toward the end (right).
#PG_Grid_JustifyContent_SpaceAround : Space is distributed evenly around columns (half-size space at ends).
#PG_Grid_JustifyContent_SpaceBetween : Space is distributed evenly between columns; first column at start, last at end.
#PG_Grid_JustifyContent_SpaceEvenly : Space is distributed evenly between and around columns.
Return Value
Returns #True if the justification mode was successfully
set, or #False if the layout handle or constant was
invalid.
Remarks
This property only applies to layouts whose type is
#PG_Layout_Type_Grid. It controls the alignment of the grid
as a whole within its container along the horizontal axis.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
MyWindow = CreateWindow(0, 0, 500, 300, "Grid Justify Content", #PG_Window_Default | #PG_Window_LayoutGrid) ; Create with a grid layout
If MyWindow
LayoutSetPadding(#Null, 10) ; Set the current layout padding
LayoutGridSetGapSize(#Null, 10)
; Define fewer columns than will fill the space
LayoutGridSetColumn(#Null, 1, 100)
LayoutGridSetColumn(#Null, 2, 100)
; Center the entire grid horizontally
LayoutGridSetJustifyContent(#Null, #PG_Grid_JustifyContent_Center)
; Add some test widgets
Widget1 = CreateWidget(0, 0, 0, 50)
Widget2 = CreateWidget(0, 0, 0, 50)
WindowShow(MyWindow, #True, #PG_WindowShow_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()See Also
LayoutSetType, LayoutGridGetJustifyContent, LayoutGridSetAlignContent, LayoutGridSetJustifyItems
Supported OS
Windows, Linux