2.2.4.22.30 Grid::SetCurrentCell

Description

It highlight the specified cell on the active sheet.

Syntax

BOOL SetCurrentCell( int nRow, int nCol, BOOL bTranslate = TRUE )

Parameters

nRow
[input] Row index (0 offset)
nCol
[input] Column index
bTranslate
[input] Translate from Data region into Raw region cell, if not, it will use the absolute position without Data/Label consideration

Return

True if successfully highlighted the specified cell, else return false.

Examples

EX1

void Grid_SetCurrentCell_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);
        
        //select the right-bottom cell
        nRow = wks.GetNumRows() - 1;
        nCol = wks.GetNumCols() - 1;
        BOOL bRet = grid.SetCurrentCell(nRow, nCol, bTranslate);
    }    
}

Remark

See Also

Header to Included

origin.h