CGrid:SetDim
The SetDim method specifies the number of columns, rows, and sheets in the grid. Each sheet is configured with the same number of columns and rows.
G:SetDim( nCols )
G:SetDim( nCols, nRows )
G:SetDim( nCols, nRows, nSheets )
where
nCols is the number of columns to set in each sheet.
nRows is the number of rows to set in each sheet. If omitted, it defaults to 1
nSheets is the number of sheets to set. If omitted, it defaults to 1.
The following script creates a grid and increases its dimensions at a later time. Before increasing the dimension, sheet 3 is undefined and the number of rows is 0. After changing the dimensions, sheet 3 exists and hwnce the number of rows is valid.
|
-- new grid with 3 cols, 10 rows, 1 sheet |
|
-- result: rows = 10 |
|
-- Select sheet 3 (out of range) |
|
-- result: rows = 0 (sheet out of range) |
|
-- change to 10 columns, 12 rows, 4 sheets |
|
-- Select sheet 3 (sheet in range) |
|
-- result: rows = 12 |