CGridCtrl:FromTable, CGridView:FromTable


The FromTable method copies the contents of a 2-dimensional table to the grid. Each index of the table contains a row of data which is itself a table of data to save in the columns.

Syntax

CGridCtrl:FromTable( table )

bullet.gif    table is a 2-dimensional table containing the cell values, organized in row order.

Example

The following script returns the entire grid contents as a 1-dimensional array with values that are numbers.:

V = new_gridview("My Grid")

-- create CGridView with default properties

G = new_gridctrl(V)

-- create a CGridCtrl for the window

tbl = {}

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

tbl[1] = { -4.658, 6, 10 }

-- set a 1-dimensional array with numbers in 3 columns of row 1

tbl[2] = { 17, 18, 25.7 }

-- set a 1-dimensional array with numbers in 3 columns of row 2

tbl[3] = { -6, -2, 3.5 }

-- set a 1-dimensional array with numbers in 3 columns of row 3

G:FromTable(tbl)

-- Set the grid to the contents of the table

Related Topics

CGridCtrl class

ToTable

SetRect


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