I am working on a program that displays displays text similar to a text editor. The program works as expected, however, it takes a very long time to display a text file that is 60k or larger.
I am using CEditView as view. Here is the algorithm that displays the texts.
int MAXSIZE = 256;
CEdit &edit = GetEditCtrl();
edit.GetLine(0, text, MAXSIZE); // get first line "first line"
CString newText, temp;
newText.Formate("%s%s%s", temp, "\r\n", newText);
The concept of the algorithm is this:
1) display first line
2) get first line
3) add first line & new line in a string
4) display string
5) continue until all *new lines* are added
As you can see, this algorithm is extremely impractically. I compared it to Microsoft's Notepade. Notepage *does not* slow done until you open a file that is 1mb or larger.
Is there a better and *faster* way to display multiple lines of text while using the CEditView? Is there a way at all?