views:

147

answers:

1

I have a wxTextCtrl and I need to put a very large string into it. (Like a 15 MB string) The only problem is it's very slow. Here is what I'm doing:

char * buff = ...
wxString data(buff, wxConvUTF8);
text->ChangeValue(data);

However, this is not the bottleneck. That occurrs as soon as the function this block of code is in returns. The whole app freezes for about 30 seconds. I tried wxYield right after ChangeValue and that causes the first few lines of the string to be displayed in the control but it still freezes after. How can I avoid this?

I must stress that ChangeValue returns almost instantaneously. The delay happens after this, probably in wxTextCtrl's internal message handlers or something.

+1  A: 

wxTextCtrl wraps the standard text control of the OS only, so any limits this has will be apparent with wxTextCtrl as well. What you can do is to use the wxStyledTextCtrl instead, which is able to load multi-megabyte texts and doesn't take long to do it. You could even highlight portions of your log by styling them (for example error messages in read), but that would probably increase loading time again.

mghie
Update: I found out what was making it so slow - my line numbering code, which I have now fixed.
George Edison