LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Ordering of panels that are loaded in different threads

I have a multithreaded application. Each thread loads a number of panels into memory.
My startup application panel(say panel C) belongs to a thread (say X).
I'm trying to display a panel A that belongs to thread X from a panel B of thread Y through a callback on a button on panel B.
My problem is that when I do this, the panel A does become visible, but panel C also comes into the foreground and I can never get panel B to be interleaved between the two panels of the same thread.
Is there a way around this?

Thanks,
Swati
0 Kudos
Message 1 of 2
(2,804 Views)
Hi Swati,

There's two ways you can do this:

1) You can post a deferred call to a thread using PostDeferredCallToThread and specify a function that does a LoadPanel and Display Panel, as well as obtain the thread ID of the main thread.

2) You can utilize a thread safe queue to pass a flag from one thread to the other. Then have the callback on the main thread, and in that tsq's callback call the loadpanel and display panel. I have attached an example of this here. Personally, I think the first suggestion would be easiest, but if you have other data you need to share between threads, then the TSQ is the way to go. Hope this helps!

Jeremy L.
National Instruments
Jeremy L.
National Instruments
Message 2 of 2
(2,788 Views)