, "/R/N" is the line feed. Edit also needs to be set to multiline. Auto hscroll to false, and want return is set to true.
/R is soft carriage return, that is, when the number of characters reaches a certain number of full rows, the line breaks automatically without carriage return.
/N is a hard carriage return, that is, the line feed is only used when you enter the return key.
InProgramWhen you press enter in
/*
In the C ++ file,/n can implement line breaks. The edit of VC is different from this
*/
/*
VC-wilderness (289956293) 16:00:36
So, why does the program close when I press Enter when the input focus is in edit?
VC-wilderness (289956293) 16:00:51
Is this the default Processing Method for "edit" to "enter?
VC-half sugar (65066313) 16:00:55
Send the idok
VC-half sugar (65066313) 16:01:09
Block
VC-half sugar (65066313) 16:01:19
Or perform other processing.
/**
Note: onok is a virtual function of DLG. It can be solved by reloading it.
Enter key when the input focus is in edit. The system calls DLG: onok.
*/
VC-CCL (414927703) 16:02:17
Whether to receive the Enter key in the edit attribute
VC-wilderness (289956293) 16:03:23
Want return
VC-CCL (414927703) 16:03:23
If "want return" is selected, edit can wrap the line. Press enter to close the dialog box,
If this option is not selected, line breaks are not allowed. Since line breaks are not allowed, you press the Enter key. Of course, the line breaks down.
*/
After multiple tests, the methods of automatic line feed and automatic screen scrolling in the VC edit box are summarized.
Method 1: (when edit is mapped to a cstring)
M_string = m_string + snewstring + "/R/N" // wrap
Updatedata (false );
This method can only achieve automatic line feed, does not automatically scroll to the last line.
Method 2: (when edit is mapped to one edit)
M_edit.setsel (-1,-1); // automatically scrolling
M_edit.replacesel (snewstring + "/R/N"); // line feed
Updatedata (true );
This method can achieve automatic line feed and automatically scroll to the last line.
M_string and m_edit are member variables added to the edit box respectively. snewstring is the string to be displayed.
Note the differences between the updatadata parameters in method 2.
I found that modifying the edit box attributes, such as auto_hscroll, is of little use.