LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does my program freeze when calling DisplayPanel in a secondary thread?

I have a panel which I load in the main thread.  I am trying to then use DisplayPanel to make it visible in a secondary thread but my program freezes.  Do I have to use DisplayPanel in the main thread or is there a way to work around this?  Thanks!
0 Kudos
Message 1 of 3
(3,043 Views)

Hello hillb,

Panels are associated with the thread in which they are created. This doesn't mean that you can't access them or their controls, from other threads, including displaying them, but it does mean that you need to run their event loop in the thread with which they're associated, otherwise their UI will freeze.

In your case, since you are loading the panel in the main thread, that main thread needs to be continually calling one of the event processing functions (RunUserInterface, ProcessSystemEvents, GetUserEvent) while that panel is active. Calling these functions in the thread which displays the panel will not be of help.

If you're already doing this, and the problem is something else, please give me some more information about what your code is doing, and we'll see if we can figure out what the problem is.

Luis

0 Kudos
Message 2 of 3
(3,025 Views)
Thanks! That took care of it...although my program can't close now but I'm sure I can figure that out.
0 Kudos
Message 3 of 3
(3,013 Views)