CGridView:delete CGridView:FindCol2

CGridView:FindCol


The FindCol method returns the column number containing the specified string. The column names are matched to the target name by ignoring differences in case, so that matching to the target string "mag", "Mag", or "MAG" will give the same result. By default, the search is performed in the first top heading row at index 0. You can also search another top heading at row index -1, -2, etc., or the grid body starting at row 1.

This method strips leading and trailing whitespace from the grid's column title before comparing to the target name. To find a column by matching the exact name in the grid (wihout matching the case), use FindCol2. For example, suppose you wish to find the grid column with the title "Mag". If the grid title is "Mag " or " Mag", then the present function finds the match because it ignores the leading whitespace in " Mag" and the trailing whitespace in "Mag ". However, the FindCol2 method does not find a match and returns -10.

Syntax

nColumn = CGridView:FindCol( strName )

nColumn = CGridView:FindCol( strName, nRow )

bullet.gif    Where strName is the string to locate.

bullet.gif    Optionally, nRow specifies a different row to search. If this is omitted, only row 0 (the first top-heading row) is searched.

bullet.gif    nColumn is returned as the index of the column found. On error, -10 is returned, as it is unlikely a grid has more than 10 side columns.

Example

The following script attaches a grid window and finds a named column:

G = attach_gridview()

-- attaches the top-most grid window from Mira

nCol = G:FindCol("x center")

-- returns the column with top heading "x center".

Related Topics

CGridView class

GetCol

GetStr

FindCol2

FindRow

 

 


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