CGXGridCore::CanSelectCurrentCell
virtual BOOL CanSelectCurrentCell(BOOL bSelect, ROWCOL dwSelectRow, ROWCOL dwSelectCol, ROWCOL dwOldRow, ROWCOL dwOldCol);?
bSelect
Specifies if the cell will be activated (TRUE) or deactivated (FALSE).
dwSelectRow
Specifies the new row index for the current cell.
dwSelectCol
Specifies the new column index for the current cell.
dwOldRow
Specifies the old row index for the current cell.
dwOldCol
Specifies the old column index for the current cell.
Return Value
TRUE when deselecting the old or selecting a new current cell is possible. It is FALSE if it should be avoided.
Remarks
Overridable method that is called to determine if the new current cell can be selected or the old current cell deselected. If the cell gets deselected, CanSelectCurrentCell returns OnValidateCell; otherwise it returns TRUE.
If the view is activated or deactivated, the coordinates specifying the old and the new current cell are equal.
The base-class version of this method checks the GetEnabled flag of the new cell’s style. If it is FALSE, CanSelectCurrentCell will return FALSE.
You can override this method if you want to prevent the grid-component selecting another current cell. See the example.
Example
This example illustrates how to prevent the grid-component selecting a new current cell.
BOOL CGXUserAttributPageGrid::CanSelectCurrentCell(BOOL bSelect, ROWCOL dwSelectRow, ROWCOL dwSelectCol, ROWCOL dwOldRow, ROWCOL dwOldCol)
{
if (dwSelectCol == 1)
return FALSE;
return CGXGridWnd::CanSelectCurrentCell(bSelect,
dwSelectRow, dwSelectCol, dwOldRow, dwOldCol);
}
See Also
CGXGridCore::OnValidateCell CGXGridCore::SetCurrentCell CGXGridCore::OnMovedCurrentCell