WidgetSetRowSpan

Syntax

Success = WidgetSetRowSpan(Widget, Span)

Description

Sets the number of rows the specified widget should span within its parent Grid layout.

Parameters

Widget
The handle of the ProGUI widget.

Span
The number of rows 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 `columnSpan` set, `columnSpan` defaults to 1 if not previously set.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

MyWindow = CreateWindow(0, 0, 200, 300, "Grid Row Span")
RootLayout = WindowGetLayout(MyWindow)
LayoutSetType(RootLayout, #PG_Layout_Type_Grid)
LayoutSetPadding(RootLayout, 10)
LayoutGridSetGapSize(RootLayout, 5)

; Define 2 columns and 3 rows (auto height)
LayoutGridSetColumn(RootLayout, 1, 50, #True) ; 50% width
LayoutGridSetColumn(RootLayout, 2, 50, #True) ; 50% width
LayoutGridSetRow(RootLayout, 1, #PG_Grid_Auto)
LayoutGridSetRow(RootLayout, 2, #PG_Grid_Auto)
LayoutGridSetRow(RootLayout, 3, #PG_Grid_Auto)


If MyWindow
  ; Widget 1 spanning rows 1 and 2 in column 1
  Widget1 = CreateWidget(0, 0, 50, 100)
  WidgetSetClass(Widget1, "cell1")
  WidgetSetColumnStart(Widget1, 1)
  WidgetSetRowStart(Widget1, 1)
  WidgetSetRowSpan(Widget1, 2) ; Span 2 rows

  ; Widget 2 in column 2, row 1
  Widget2 = CreateWidget(0, 0, 50, 30)
  WidgetSetClass(Widget2, "cell2-1")
  WidgetSetColumnStart(Widget2, 2)
  WidgetSetRowStart(Widget2, 1)

  ; Widget 3 in column 2, row 2
  Widget3 = CreateWidget(0, 0, 50, 30)
  WidgetSetClass(Widget3, "cell2-2")
  WidgetSetColumnStart(Widget3, 2)
  WidgetSetRowStart(Widget3, 2)

  WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)

  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf

StopProGUI()

See Also

WidgetGetRowSpan, WidgetSetRowStart, WidgetSetColumnSpan, WidgetSetColumnStart, LayoutSetType

Supported OS

Windows, Linux