GridParams Table


The GridParams table contains properties used for creating new CGrid and CGridView objects. This table is passed to the new grid objects using the new_grid, new_gridview functions and the CGrid:new and CGridView:new methods. The table below describes the properties of the GridParams table. Change them at grid creation time to set the property of the grid. They may also be overridden by various grid methods.

 

Property Name

Definition

 

Default Value

nCols

The number of grid columns.

 

10

nRows

The minimum number of grid rows. This value will be rounded up to a multiple of 256 rows. See the comments in the Example, below.

 

20

nSheets

The number of grid sheets. If omitted, 1 sheet is assumed.

 

1

nSH_Cols

The number of columns in the side heading area left of the grid rows.

 

1

nSH_Width

The width, in screen pixels, of each side heading column.

 

30

nTH_Rows

The number of rows in the top heading area above the grid columns.

 

1

nTH_Height

The height, in screen pixels, of each top heading row. This varies according to the height of the current grid font.

 

16

nDefColWidth

The default column width, in screen pixels.

 

100

nRowStretch

The stretch factor for the height of rows compared with the font height.

 

1.5

nTH_RowStretch

The stretch factor for the height of top heading rows compared with the font height.

 

1.5

nHorzAlign

The horizontal alignment of columns in the grid body.

 

1 (left)

nVertAlign

The vertical alignment of rows in the grid body.

 

2 (middle)

nSH_HorzAlign

The horizontal alignment of side heading columns.

 

1 (left)

nTH_VertAlign

The vertical alignment of top heading rows.

 

2 (middle)

sBodyFace

The color of the font in the regular grid.

 

"0.0.0"

sBodyBk

The background color of the font in the regular grid.

 

"255,255,255"

sHdgFace

The color of the font in the headings.

 

"0.0.0"

sHdgBk

The background color of the font in the headings.

 

"255,255,255"

Example

The script below sets the grid properties in a GridParams table and passes it to the script creation using new_gridview. This script creates a Mira grid window with 10 columns and 20 rows. Note that the property names must be spelled exactly as shown, including upper and lower case, and that a comma must be used after each table value. For reasons of internal efficiency, the specified number of rows is rounded up to a multiple of 256. For example, if you set nRows = 257, Mira creates a grid having 512 rows. It is not necessary to use all the extra rows.

 

GridParams =

-- define the properties

{

 

  nCols = 10,

 

  nRows = 20,

 

  nSheets = 1,

 

  nSH_Cols = 1,

 

  nSH_Width = 24,

 

  nTH_Rows = 1,

 

  nTH_Height = 16,

 

}

 

G = new_gridview("My Grid Name", GridParams )

-- creates a new CGridView window

if G ~= nil then

 

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

Result: cols = 10

  Printf("rows = %d\n", G:GetNumRows())

Result: rows = 256

end

 

Related Topics

CGridView class, CGrid class, new_gridview, new_grid


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.