2.2.4.22.13 Grid::GetCurrentCell

Description

It retrieve the location of the cursor on the active sheet.

Syntax

int GetCurrentCell( int & nRow, int & nCol, BOOL bTranslate = true )

Parameters

nRow
[output] Row index (0 offset)
nCol
[output] Column index
bTranslate
[input] Translate into Data or Label region, if not, will return absolute position without Data/Label consideration

Return

-1 if grid not present

0 if no cursor

1 if cursor is in data area, if bTranslate = FALSE, then will just return 1 regardless if in Data or Label region

2 if cursor is in Column Label area but not in Row Label area

4 if cursor is in Row Label area but not in Column Label area

6 if cursor is in both Column Label and Row Label area

Examples

EX1

void Grid_GetCurrentCell_ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if ( wks )
    {
        Grid grid;
        grid.Attach(wks);
        int nRow, nCol;
        BOOL bTranslate = true;
        int nRet = grid.GetCurrentCell(nRow, nCol, bTranslate);
        printf("Select cell in active worksheet is (%d, %d)\n", nRow + 1, nCol + 1);
    }
}

Remark

See Also

Header to Included

origin.h