Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Select cell in OnInplaceControlPreTranslateMessage Collapse All
Subject Author Date
Bart Kampers Aug 13, 2009 - 8:27 AM

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);

}


Technical Support Aug 13, 2009 - 12:57 PM

You don’t need to code this feature. Please apply the __EGWS_BSE_WALK_VERT style or the __EGWS_BSE_WALK_VERT|__EGWS_BSE_WALK_VERT_NO_EDIT style set using the BseModifyStyle() method.

Bart Kampers Aug 14, 2009 - 1:48 AM

Very nice. Thanks.