Click to See Complete Forum and Search --> : I need to tab to next CEdit using the <ENTER> key instead of the <TAB> key . . .


Johnny DeMichael
May 6th, 1999, 04:03 PM
appreciate any suggs. Thanks. JD

May 6th, 1999, 04:35 PM
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);
}

Rail Jon Rogut
May 6th, 1999, 05:44 PM
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
railro@earthlink.net
http://home.earthlink.net/~railro/

Marco
May 6th, 1999, 10:26 PM
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-&gt;SetFocus();
if ( pNextItem-&gt;IsKindOf( RUNTIME_CLASS( CEdit )) )
((CEdit*)pNextItem)-&gt;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 ....

Johnny DeMichael
May 7th, 1999, 11:40 AM
eom

Johnny DeMichael
May 7th, 1999, 11:44 AM
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

Johnny DeMichael
May 7th, 1999, 11:46 AM
eom

Johnny DeMichael
May 8th, 1999, 08:38 AM
Tried to email you . . undeliverable (?), anyway,

Rail, could you please point me to what I need to read or tools available to
learn to create a web page & others would be able to download programs from
the site. (like yours) Thanks very much for any suggestions you might be
able to provide. My email is JMR@ATLASCOMM.NET
Thanks, John