Processing Tab in CEdit control

Hi !
I want to process tab key in a CEdit control i.e. whenever user presses Tab key, instead of moving out of control, the cursor should move in a CEdit control.
-Regards
Sun307
LVL 2
sun307Asked:
Who is Participating?
 
timopConnect With a Mentor Commented:
Hi,

To process TAB key in the CEdit control you have to override OnGetDlgCode ( message handler for WM_GETDLGCODE ).
Now, CMyEdit::OnChar will be called when TAB is pressed.

UINT CMyEdit::OnGetDlgCode()
{
      return CEdit::OnGetDlgCode() | DLGC_WANTTAB;
}



0
 
inprasCommented:
Hi
Derive UR own class from CEdit let it be CMyEdit map Onchar to CMyEdit
UR control should be of type CMyEdit
then in function
CMyEdit::OnChar(.......)
{
   if (nCahr == VK_TAB)
     //Move in a Edit Control by using SetFocus();
}

Hope this helps
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.