Objective Grid: Discarding the selection when the user changes the current cell

Article ID: 570
Last updated: 11 Apr, 2018
Article ID: 570
Last updated: 11 Apr, 2018
Revision: 3
Views: 1536
Posted: 12 Jan, 2001
by Meltreger B.
Updated: 11 Apr, 2018
by Meltreger B.

Problem


In MS Excel, the selection will be discarded when the user moves the current cell with the arrow keys. How can I force the grid to behave the same way?


Cause



Action


You should override the MoveCurrentCellEx() method.

Example:

BOOL CMyGrid::MoveCurrentCellEx(int direction, UINT nCell)
{
BOOL bCtl = GetKeyState(VK_CONTROL) & 0x8000;
BOOL bShift = GetKeyState(VK_SHIFT) & 0x8000;

if (!GetParam()->IsEnableSelection(GX_SELKEYBOARD) || !bCtl && !bShift)

SelectRange(CGXRange().SetTable(), FALSE);
return CGXGridCore::MoveCurrentCellEx(direction, nCell);
}

This article was:   Helpful | Not helpful
Report an issue
Article ID: 570
Last updated: 11 Apr, 2018
Revision: 3
Views: 1536
Posted: 12 Jan, 2001 by Meltreger B.
Updated: 11 Apr, 2018 by Meltreger B.

Others in this category