Syntax
Success = WidgetSetColumnSpan(Widget, Span)
Description
Sets the number of columns the specified widget should span within its parent Grid layout.
Parameters
Widget
The handle of the ProGUI widget.
Span
The number of columns the widget should occupy. Must be 1 or greater.
Default is 1.
Return Value
Returns #True if the span was successfully set, or #False if the widget handle
is invalid or the span value is less than 1.
Remarks
This property is only relevant for widgets placed within a layout of type
#PG_Layout_Type_Grid. Setting the span triggers a layout update. If the widget also has
`rowSpan` set, `rowSpan` defaults to 1 if not previously set.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
MyWindow = CreateWindow(0, 0, 300, 200, "Grid Column Span")
RootLayout = WindowGetLayout(MyWindow)
LayoutSetType(RootLayout, #PG_Layout_Type_Grid)
LayoutSetPadding(RootLayout, 10)
LayoutGridSetGapSize(RootLayout, 5)
; Define 3 columns, auto sized
LayoutGridSetColumn(RootLayout, 1, #PG_Grid_Auto)
LayoutGridSetColumn(RootLayout, 2, #PG_Grid_Auto)
LayoutGridSetColumn(RootLayout, 3, #PG_Grid_Auto)
LayoutGridSetRow(RootLayout, 1, #PG_Grid_Auto) ; Define one row
If MyWindow
; Widget 1 in column 1
Widget1 = CreateWidget(0, 0, 0, 0)
WidgetSetClass(Widget1, "cell1")
; WidgetSetColumnStart(Widget1, 1) ; Default is 1
; Widget 2 spanning columns 2 and 3
Widget2 = CreateWidget(0, 0, 0, 0)
WidgetSetClass(Widget2, "cell2-3")
WidgetSetColumnStart(Widget2, 2) ; Start in column 2
WidgetSetColumnSpan(Widget2, 2) ; Span 2 columns
; Create 3 more widgets on the next row (new row created automatically)
CreateWidget(0, 0, 0, 0)
CreateWidget(0, 0, 0, 0)
CreateWidget(0, 0, 0, 0)
WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()
See Also
WidgetGetColumnSpan, WidgetSetColumnStart, WidgetSetRowSpan, WidgetSetRowStart, LayoutSetType
Supported OS
Windows, Linux