Page 1 of 1

medium to large programmatic updates to a wxTextCtrl

Posted: Thu Jan 09, 2020 4:24 pm
by bsenftner
I have a multi-line wxTextCtrl that sits in a wxPanel next to a wxGlCanvas. The wxGlCanvas updates at a 30 fps rate, and the wxTextCtrl displays information messages generated by the wxGlCanvas code as it runs.

One if the things that can be sent to the wxTextCtrl are text files (scripts) associated with the logic driving the wxGlCanvas. This is done with a programmatic loop adding each line of the text file to the wxTextCtrl. The end result is a brief pause in the application and then the wxTextCtrl appears with the complete text added. (These text scripts can be long.)

Wanting to avoid that pause as a text file is added to the wxTextCtrl, I have tried adding a wxYield() after the addition of every 5 lines of text to get the wxTextCtrl to appear with the text visually growing as it is added. Is this the best method, using wxYield(), when programmatically adding text to a wxTextCtrl to both avoid application pause and to see the text addition incrementally?

Re: medium to large programmatic updates to a wxTextCtrl

Posted: Thu Jan 09, 2020 4:53 pm
by doublemax
As you can't do GUI updates from a secondary thread, there are not many other ways to do it. I probably would have done it from a timer event to avoid the wxYield, but the result is the same.