I have a TextArea where I am doing some syntax coloring via StyledText. It all works quickly and without issue on MacOS, but when I run it Windows it hangs on the first attempt to modify the StyledText. Here’s the first few lines where I modify it:
I have commented out these line sequentially and it will always hang on the first one executed. This code is in a thread, and when it hangs i can’t even get the debugger to pause or stop. I can quit the app using the window’s close button, but only after Windows says the app is unresponsive and i tell it to force quit.
The text being processed is only 30 or 40 characters, so I don’t think that is the issue.
I had it in the main thread initially, but longer strings can take some time to process and the app beachballs on those so I moved it to a thread. I never tested on Windows until I was done with the app, so I’ll give the main thread a shot and see what happens.
It seems like you’re right @Greg_O. On Windows the code runs in the main thread, but the UX is miserable (watching the TextArea flash for 6 or 7 seconds).
I hope the bug isn’t that I can manipulate the styledText from a thread on MacOS at all, since that works great for me.
Would it be possible to, in a thread, instantiate a new StyledText object, modify it, and then assign it back to the TextArea?
I honestly don’t know. You could however, use a method that calls a thread which calls back to a method on Mac and just skip the thread and directly call it on Windows. I seem to remember there being a command on windows that lets you freeze drawing… maybe in the “I wish I knew” book about windows declares.