Trapping ENTER key to move to next control 
Author Message
 Trapping ENTER key to move to next control

We have a customer that is stongly advocating having the ENTER key in a
dialog moving behave like the TAB key by moving the keyboard focus to the
next control in the tab order.  I know that this is not standard windows
behavior (although there are a few applications out there that give you the
option of setting the RETURN key to behave like a tab).  I am trying to
scope out the effort and wanted to get any ideas or experiences anyone has
with this.

Thank you in advance,

-Rob



Wed, 31 Mar 2004 03:54:31 GMT  
 Trapping ENTER key to move to next control
What about trapping the OnKeyDown event and if the key sent is the return
key, then just fake a Tab key press. And then trap the OnKeyUp to make sure
that the Enter isn't handled when the key is released either.

that would seem to be a pretty simple way to solve it.

-matt

Quote:
> We have a customer that is stongly advocating having the ENTER key in a
> dialog moving behave like the TAB key by moving the keyboard focus to the
> next control in the tab order.  I know that this is not standard windows
> behavior (although there are a few applications out there that give you
the
> option of setting the RETURN key to behave like a tab).  I am trying to
> scope out the effort and wanted to get any ideas or experiences anyone has
> with this.

> Thank you in advance,

> -Rob



Wed, 31 Mar 2004 04:20:28 GMT  
 Trapping ENTER key to move to next control
I just tried this and it worked ok

BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{

    if ( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN )
        pMsg->wParam = VK_TAB;

 return CDialog::PreTranslateMessage(pMsg);

Quote:
}



Quote:
> We have a customer that is stongly advocating having the ENTER key in a
> dialog moving behave like the TAB key by moving the keyboard focus to the
> next control in the tab order.  I know that this is not standard windows
> behavior (although there are a few applications out there that give you
the
> option of setting the RETURN key to behave like a tab).  I am trying to
> scope out the effort and wanted to get any ideas or experiences anyone has
> with this.

> Thank you in advance,

> -Rob



Wed, 31 Mar 2004 04:44:59 GMT  
 Trapping ENTER key to move to next control
Override PreTranslateMessage and then call NextDlgCtrl if Enter key is hit.

--
Ajay Kalra [MVP - VC++]

Note: Please post all replies to newsgroup only.


Quote:
> We have a customer that is stongly advocating having the ENTER key in a
> dialog moving behave like the TAB key by moving the keyboard focus to the
> next control in the tab order.  I know that this is not standard windows
> behavior (although there are a few applications out there that give you
the
> option of setting the RETURN key to behave like a tab).  I am trying to
> scope out the effort and wanted to get any ideas or experiences anyone has
> with this.

> Thank you in advance,

> -Rob



Wed, 31 Mar 2004 06:07:49 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. cannot trap the enter key using atl control that is hosted in a container

2. Trapping the enter key in a Datagrid cell

3. Trapping ENter KEY

4. trapping ENTER KEY

5. Trapping Enter Key

6. trapping the enter key in a dialog app

7. Trapping ESC, ENTER key for dialogs

8. Trapping ENTER KEY

9. CListCtrl - trapping ENTER key

10. How to trap tab and enter keys in a Dialog Box

11. How to trap tab and enter keys in a Dialog Box

12. Trapping the ENTER key in an Edit box

 

 
Powered by phpBB® Forum Software