samyee
asked on
HELP: New line in CEdit
How to insert a new line and other formatting (e.g. tab) in a multi-line CEdit control???
in my code
=====
m_edit = _T("Hello\n World \t Hello");
UpdateDate(FALSE);
========
Garbage char appears instead!!! Pls show me simple sample code as well.... thanks :-)
Another question: I notice when I make the CEdit read-only... the text is all highlighted initially....
How to remove that selection???
in my code
=====
m_edit = _T("Hello\n World \t Hello");
UpdateDate(FALSE);
========
Garbage char appears instead!!! Pls show me simple sample code as well.... thanks :-)
Another question: I notice when I make the CEdit read-only... the text is all highlighted initially....
How to remove that selection???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The proper way to insert a new line into a multi-line edit control is to use:
CString String;
String = "This is one line of the string.\r\nThis is the next line is here.";
\r\n in place of the \n. To insert a tab, the \t should work proplerly.
J.R.
CString String;
String = "This is one line of the string.\r\nThis is the next line is here.";
\r\n in place of the \n. To insert a tab, the \t should work proplerly.
J.R.
ASKER
Thanks pagladasu!!!
And also to jrmcg who suggest a good method!!!
And also to jrmcg who suggest a good method!!!
If at all you do not want the read-only edit control not to get any focus you can
uncheck the Tabstop property of the control.
Otherwise, if you want it to receive tab focus, then create a control variable, say called m_editctrl of type CEdit. Map the EN_SETFOCUS message of the edit control and insert the following code in the OnSetfocusEdit1():
m_editctrl.SetSel(0,0);