There is a similar functionality for arrow keys. You can turned it on by applying __EGWS_BSE_WALK
to your grid. But if you need to make it work for the VK_RETURN
key, you should implement it yourself. Please take a look at the CExtGridInplaceEdit::WindowProc()
method and analyze the following code snippet. It implements moving to the next cell when the arrow key is pressed.
if( bTranslate )
{
LRESULT lResult = 0L;
HWND hWndParent = GetParent()->GetSafeHwnd();
if( hWndParent != NULL )
{
HWND hWndOwn = m_hWnd;
HWND hWndGrid = m_wndGrid.m_hWnd;
CExtGridWnd * pWndGrid = &m_wndGrid;
_DoEndEdit( true );
lResult = ::SendMessage(hWndParent,WM_KEYDOWN,wParam,lParam);
if( ::IsWindow(hWndGrid)
&& ( ! ::IsWindow(hWndOwn) )
&& CWnd::FromHandlePermanent(hWndGrid) == pWndGrid
)
{
ASSERT_VALID( pWndGrid );
pWndGrid->EditCell();
}
}
return lResult;
} // if( bTranslate )
Then analyze the code after the following line:
case VK_RETURN:
It implements the behavior when the
Return key is pressed.
So what you need to do is to declare a
CExtGridInplaceEdit
derived class. In it, override the
WindowProc
virtual method and add a handler for the
VK_RETURN
button like for the arrow keys. Then override the
CExtGridCellString::OnInplaceControlCreate
virtual method and create your inplace control there.