I have a Canvas subclass that instantiate a Thread and wire the Run event to one method of this class using AddHandler()
First question: considering the Canvas is part of the UI, is that legal?
It works properly on RS2012r2.1 and Xojo did not complain with an exception, but I’d like to know what you think about.
In the same class, my thread code, which simply build some thumbnails in background, calls self.Invalidate to tell the canvas to refresh when possible.
This indeed fire an exception because I’m accessing the UI. It was expected, even if it worked fine in RS2012r2.1.
Here my question: is that really necessary to deny an Invalidate? I understand it access the UI, but really is not drawing or doing complicate things, just invalidate the canvas. But may be I’m underestimating the problem.
I would also like to get some clarity on calling Invalidate from threads. From the new Xojo user manuals, I understand that Control.Invalidate is preferred instead of Control.Refresh, since Invalidate lets the OS decide when it’s best to refresh a control?
My knowledge is very vague on the issue, but it would certainly be a huge benefit to have the ability to Invalidate my OpenGL surfaces from threads.
Oops! You are right. I was too confident on the AutoComplete and Status which only suggests the simple version.
However, since we have Refresh and RefreshRect, I first tried to do InvalidateRect, which clearly didn’t work. This expose a consistency problem on the framework. They definitely should adopt one of the two, but not both.