LayoutGridGetRowCount

Syntax

Count = LayoutGridGetRowCount(Layout)

Description

Retrieves the number of explicitly defined rows in the grid template for the specified Grid layout.

Parameters

Layout
The handle of the Grid layout object. If #Null, it targets the current layout.

Return Value

Returns the number of explicitly defined rows as an Integer. Returns #False (0) if the layout handle is invalid or the layout is not of type Grid.

Remarks

This counts the number of rows for which a size (even #PG_Grid_Auto or #PG_Grid_Default) has been set using LayoutGridSetRow(). The actual grid might have more rows if items are placed beyond this count, in which case the default row settings apply.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

MyWindow = CreateWindow(0, 0, 400, 300, "Grid Row Count", #PG_Window_Default | #PG_Window_LayoutGrid) ; Create with a grid layout

If MyWindow
  LayoutGridSetRow(#Null, 1, 50)
  LayoutGridSetRow(#Null, 2, #PG_Grid_Auto)
  ; Row 3 is not explicitly defined
  
  CreateWidget(0, 0, 0, 0) ; Create some test widgets
  CreateWidget(0, 0, 0, 0)
  CreateWidget(0, 0, 0, 0)

  Count = LayoutGridGetRowCount(#Null)
  Debug "Explicitly Defined Rows: " + Count ; Output should be 2

  WindowShow(MyWindow, #True, #PG_WindowShow_ScreenCentered)

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

StopProGUI()

See Also

LayoutSetType, LayoutGridSetRow, LayoutGridGetColumnCount

Supported OS

Windows, Linux