CGridView:SetNumRows CGridView:SetCol

CGridView:SetRect


The SetRect method saves the contents of a 2-dimensional table to cells in a rectangular region of the grid. Also see the related FromTable method.

Syntax

CGridView:SetRect( tbl, rect )

bullet.gif    Where tbl is a 2-dimensional 1-dimensional array with values that are numbers.

bullet.gif    rect is a CRect object containing the column and row limits where the lua able will be saved to the grid.

Example

The following script returns the cell contents in columns 4 through 8 and rows 2 through 3:

G = new_gridview("Grid")

-- create CGridView with default properties

tbl = {}

-- create a 1-dimensional array with values that are numbers.

tbl[1] = { 3, 5, 7, -10, 4 }

-- create a 5-column table for the first row

tbl[2] = { -4, -6, -8, 10, 12 }

-- create a 5-column table for the second row

G:SetRect( tbl, new_rect(4, 8, 2, 3) )

-- set the contents of columns 4:8, rows 2:3

Printf("val(5,3 )= %s\n", G:GetStr(5,3))

-- result: val(5,3) = -6

Related Topics

CGridView class

GetRect

SetCol

SetRow

SetStr

FromTable


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