CGrid:GetNumCols


The GetNumCols method returns the number of columns in the current grid sheet. The number of columns may differ between sheets.

Syntax

nCols = G:GetNumCols()

where

    nCols is the number of columns in the grid. On failure, 0 is returned.

Example

The following script creates a grid and increases the number of columns at a later time:

G = NewGrid(3,10)

-- new grid with 3 cols, 10 rows, 1 Sheet

Printf("cols = %d\n", G:GetNumCols() )

-- result: cols = 3

G:SelectSheet( 3 )

-- Select Sheet 3 (out of range)

Printf("cols = %d\n", G:GetNumCols() )

-- result: cols = 0 (sheet out of range)

G:GetNumCols( 8 )

-- change to 8 columns

Printf("cols = %d\n", G:GetNumCols() )

-- result: cols = 8

Related Topics

GetNumRows

SetNumCols

CGrid class