G
Graham Allwood
Hi
Could someone clarify something for me please?
There is a rule about not creating a Windows control on a non UI thread
isn't there but what exactly is the rule. Is it I shouldn't construct a
control on a non UI thread or I shouldn't Show a control on a non UI thread.
If I have a callback method that is invoked when a worker thread completes.
The callback method needs to display a form with some information obtained
from the worker thread. Now, the callback method is actually executed on the
worker thread, not the UI thread and so I'm creating the UI control on a
different thread. I do however have a ShowControl() method on the main form
that I call to display the newly create control and this method checks the
Form.InvokeRequired property before calling Show(), calling Invoke() if
required.
Is this the correct way of doing it or should I also be asking the UI thread
(aka the main form) to create the new UI control as well?
Hope this all make sense!!
Regards
Graham Allwood
Could someone clarify something for me please?
There is a rule about not creating a Windows control on a non UI thread
isn't there but what exactly is the rule. Is it I shouldn't construct a
control on a non UI thread or I shouldn't Show a control on a non UI thread.
If I have a callback method that is invoked when a worker thread completes.
The callback method needs to display a form with some information obtained
from the worker thread. Now, the callback method is actually executed on the
worker thread, not the UI thread and so I'm creating the UI control on a
different thread. I do however have a ShowControl() method on the main form
that I call to display the newly create control and this method checks the
Form.InvokeRequired property before calling Show(), calling Invoke() if
required.
Is this the correct way of doing it or should I also be asking the UI thread
(aka the main form) to create the new UI control as well?
Hope this all make sense!!
Regards
Graham Allwood