CGrid:TH_FindCol
The TH_FindCol method returns the column number containing the specified string. By default, the search is performed in the first top heading row at index 0. You can also search another top heading at a row index below 0, namely, -1, -2, etc., or the grid body starting at row 1.
Note: The top heading row numbering differs with the CGridView class. Moving upward from the grid, the CGrid top headings are numbered 1, 2, 3, ..., whereas the CGridView top headings are numbered 0, -1, -2, ...
nColumn = CGrid:TH_FindCol( strName )
nColumn = CGrid:TH_FindCol( strName, nHdgRow )
Where strName is the string to locate.
Optionally, nHdgRow specifies a different top heading row to search. If this is omitted, only row 0 is searched.
nColumn is returned as the index of the column found, starting with 1. On error, -10 is returned, as it is unlikely a grid has more than 10 side columns.
The following creates a CGrid, fills it with data, then finds a named column:
|
-- create a new CGrid object |
-- fill the grid |
|
|
-- returns the column with top heading "x center". |
CGrid class, Get, SH_FindRow, FindCell
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.