WidgetSetRowStart

Syntax

Success = WidgetSetRowStart(Widget, Row)

Description

Sets the starting row index (1-based) for the specified widget within its parent Grid layout. This explicitly positions the widget, overriding the automatic placement flow.

Parameters

Widget
The handle of the ProGUI widget.

Row
The 1-based index of the grid row line where the widget should start.

Return Value

Returns #True if the starting row was successfully set, or #False if the widget handle is invalid or the row 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 start row triggers a layout update. If `columnStart`, `columnSpan`, or `rowSpan` have not been set, they default to 1.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

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

; Define 2 columns and 2 rows (auto size)
LayoutGridSetColumn(RootLayout, 1, #PG_Grid_Auto)
LayoutGridSetColumn(RootLayout, 2, #PG_Grid_Auto)
LayoutGridSetRow(RootLayout, 1, #PG_Grid_Auto)
LayoutGridSetRow(RootLayout, 2, #PG_Grid_Auto)


If MyWindow
  ; Widget 1 placed automatically (will likely go in column 1, row 1)
  Widget1 = CreateWidget(0, 0, 50, 30)
  WidgetSetClass(Widget1, "cell1-1")

  ; Widget 2 explicitly placed in column 1, row 2
  Widget2 = CreateWidget(0, 0, 50, 30)
  WidgetSetClass(Widget2, "cell1-2")
  WidgetSetColumnStart(Widget2, 1) ; Explicitly set column start as well
  WidgetSetRowStart(Widget2, 2)

  WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)

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

StopProGUI()

See Also

WidgetGetRowStart, WidgetSetRowSpan, WidgetSetColumnStart, WidgetSetColumnSpan, LayoutSetType

Supported OS

Windows, Linux