Hello,
I want to create a table where the next row is selected when the down-arrow key is pressed during editing a cell. So I overrode the OnInplaceControlPreTranslateMessage method on my own cell derived from. CExtGridCellString.
Now when I hit the down-arrow editing is stoped but the editing cell stays selected.
What goes wrong?
bool CQuickLeaveCellString::OnInplaceControlPreTranslateMessage(
MSG * pMsg,
HWND hWndInplaceControl,
CExtGridWnd & wndGrid,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
const RECT & rcCellExtra,
const RECT & rcCell,
const RECT & rcInplaceControl)
{
CExtGridInplaceEdit * pEdit = static_cast <CExtGridInplaceEdit*> (CWnd::FromHandle(hWndInplaceControl));
ASSERT(pEdit != NULL);
ASSERT_VALID(pEdit);
if (pMsg->message == WM_KEYDOWN)
{
if (pMsg->wParam == VK_DOWN)
{
pEdit->DoEndEdit(true, VK_RETURN);
CRect rect;
wndGrid.GridCellRectsGet(nColNo, nRowNo + 1, nColType, nRowType, rect);
wndGrid.SelectionSet(rect, true, true, true);
return true;
}
}
return __super::OnInplaceControlPreTranslateMessage(
pMsg,
hWndInplaceControl,
wndGrid,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcInplaceControl);
}