Syntax
Success = LayoutGridSetFlow(Layout, Flow)Description
Sets the auto-placement algorithm for items in a Grid layout container. This controls whether new items fill the grid row by row and whether the algorithm tries to fill holes left by earlier items ('dense' packing).
Parameters
Layout
The handle of the Grid layout object. If #Null, it targets
the current layout.
Flow
The grid flow constant.
#PG_Grid_Flow_Row : Items are placed by filling each row. (Default)
#PG_Grid_Flow_RowDense : Items are placed by filling each row, and the algorithm attempts to fill holes.
Return Value
Returns #True if the flow mode was successfully set, or
#False if the layout handle or flow constant was
invalid.
Remarks
This property only applies to layouts whose type is
#PG_Layout_Type_Grid. It affects items that are not
explicitly positioned using WidgetSetRowStart() / WidgetSetColumnStart(). The 'dense'
algorithms may cause items to appear out of their DOM order to achieve a
more compact layout.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
MyWindow = CreateWindow(0, 0, 400, 300, "Grid Flow", #PG_Window_Default | #PG_Window_LayoutGrid) ; Create with a grid layout
If MyWindow
LayoutSetPadding(#Null, 10) ; Set the current layout padding
LayoutGridSetGapSize(#Null, 5)
LayoutGridSetColumn(#Null, 1, 100) ; Define some columns
LayoutGridSetColumn(#Null, 2, 100)
LayoutGridSetColumn(#Null, 3, 100)
LayoutGridSetRow(#Null, 1, 50) ; Define some rows
LayoutGridSetRow(#Null, 2, 50)
LayoutGridSetRow(#Null, 3, 50)
; Set flow to row-dense
LayoutGridSetFlow(Null, #PG_Grid_Flow_RowDense) ; Comment out this line to see the default #PG_Grid_Flow_Row effect
; Add some widgets
CreateButton(0, 0, 0, 0, "1")
Button = CreateButton(0, 0, 0, 0, "2")
WidgetSetColumnSpan(Button, 3) ; Because this makes the widget take up 3 columns it is forced onto a new row, leaving 2 column spaces empty on the previous row
CreateButton(0, 0, 0, 0, "3")
CreateButton(0, 0, 0, 0, "4")
WindowShow(MyWindow, #True, #PG_WindowShow_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()See Also
LayoutSetType, LayoutGridGetFlow, WidgetSetRowStart, WidgetSetColumnStart
Supported OS
Windows, Linux