Home > Software engineering >  MFC dialog box procedure how to support the TAB key to indent the EDIT control
MFC dialog box procedure how to support the TAB key to indent the EDIT control

Time:10-05

In the dialog box procedure, I want an EDIT control for text editing, but the input TAB key focus turns to other controls, without the TAB key to indent function, EDIT the document is very awkward,

In c # just setting an attribute,

Would you please tell me what the method of VC to handle the situation?

CodePudding user response:

Use RichEdit control

CodePudding user response:

Use RichEdit control

CodePudding user response:

Use RichEdit control

CodePudding user response:

If not well, the TAB key or jump to other controls, can detailed say?

CodePudding user response:

Derived their own EDIT, overloading pretranslate, send message to the parent form, again,,,,

CodePudding user response:

BOOL CMyDlg: : PreTranslateMessage (MSG * pMsg)
{
If (pMsg - & gt; Message==WM_KEYDOWN & amp; & PMsg - & gt; WParam==VK_TAB & amp; & PMsg - & gt; HWND==m_cEdit. GetSafeHwnd ())
{
//processing in the Edit TAB
CString str;
M_cEdit. GetWindowText (STR);
Int nStart nEnd;
M_cEditProgram. GetSel (nStart nEnd);
If (nStart!=nEnd)
{
STR=STR. Left (nStart) + STR. Mid (nEnd);
}
STR. Insert (nStart, "\ t");
M_cEdit. SetWindowText (STR);
M_cEdit. SetSel (nStart nStart + 1, + 1);
Return TRUE;
}
Return CDialog: : PreTranslateMessage (pMsg);
}

CodePudding user response:

on the top floor!
  • Related