CGridView:FindCol CGridView:FindRow

CGridView:FindCol2


The FindCol2 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 compares the target title to the exact grid title without stripping leading and trailing whitespace from the column title. To match the titles afer stripping whitespace from the grid title, use FindCol. 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 will not find the column match and will return -10. However, the FindCol method will find a match because it ignores the leading whitespace in " Mag" and the trailing whitespace in "Mag ".

Syntax

nColumn = CGridView:FindCol2( strName )

nColumn = CGridView:FindCol2( 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:FindCol2("x center")

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

Related Topics

CGridView class

GetCol

GetStr

FindCol

FindRow


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