I need to tab to next CEdit using the <ENTER> key instead of the <TAB> key . . .
appreciate any s****. Thanks. JD
Re: I need to tab to next CEdit using the <ENTER> key instead of the <TAB> key . . .
Try trapping the OnChar call. if the enter key is set handle as you need.
Else just pass on to the parent class. THis does require a derived class.
void CMabEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(nChar==13)
{
OnKillfocus();
return;
}
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
Re: I need to tab to next CEdit using the <ENTER> key instead of the <TAB> key . . .
See Example 5 on my web site at http://home.earthlink.net/~railro/mfc_link.html
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
Re: I need to tab to next CEdit using the <ENTER> key instead of the <TAB> key . . .
OK, try this (its a little bit "dirty" but fast, easy and works anytime)
- Put a button on your dialog.
- make it the default button (now it catches the enter key)
- hide this button
- create the OnButton...() method via class wizard
- enter a code like this (i think "OnKillFocus()" as mentioned in another post should not be called directly):
--------
void CKostenEditDlg::OnButtonReturn()
{
CWnd* pCurrentItem = GetFocus();
// if (pCurrentItem == &m_ctrlUmlage)
// OnDblclkUmlage();
// else {
CWnd* pNextItem = GetNextDlgTabItem( pCurrentItem );
pNextItem->SetFocus();
if ( pNextItem->IsKindOf( RUNTIME_CLASS( CEdit )) )
((CEdit*)pNextItem)->SetSel(0, -1);
// }
}
--------
you don't need the code I have commented, that part I used to catch the enter key on a CListCtrl (m_ctrlUmlage) and call the onDoubleClck()-method for that control ....
Rail, your page is terrific! Now how do I capture the ENTER key for a CComboBox . . .
I derived MyComboBox & thought I captured the WM_CHAR, . . . but apparently not since the function is never called. Should I just use a list box with my own CEdit . . would that be the easiest way? Sure appreciate your help! JD