WidgetSetColumnStart

Syntax

Success = WidgetSetColumnStart(Widget, Column)

Description

Sets the starting column 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.

Column
The 1-based index of the grid column line where the widget should start.

Return Value

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

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

MyWindow = CreateWindow(0, 0, 300, 200, "Grid Column Start")
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 placed automatically (will likely go in column 1, row 1)
  Widget1 = CreateWidget(0, 0, 50, 30)
  WidgetSetClass(Widget1, "cell1")

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

  WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)

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

StopProGUI()

See Also

WidgetGetColumnStart, WidgetSetColumnSpan, WidgetSetRowStart, WidgetSetRowSpan, LayoutSetType

Supported OS

Windows, Linux