LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Keep InstallPopup panel window always on the top when using multithreading

Hello,
I am creating a GUI for a certain application where i am using different threads that call InstallPopup to pop up dialog boxes for some action. However i am unable to keep this popped up panel always on top of the main panel. I am sending a small example similar to my application, where a thread is created and from the thread installpopup is called with Getuserevent. The panel that pops up should always remain on the top till an action is done.However when the parent panel is clicked this small panel goes in the hiding behind. How do I programme this ?

with gratitude
vivek $
0 Kudos
Message 1 of 3
(3,328 Views)
In Windows programming, a window that is forced to be on top of other windows is called a modal window or dialog box. There are different types of modal windows. Some are modal only within the thread that created them. Some are modal across all threads within the application that created them. Some are modal across all applications.
The modality of a CVI window is limited to the thread in which it was created. That includes predefined popups like MessagePopup() and popup panels created by InstallPopup(). You can structure your threads so one thread handles all user interface functions and other threads do data acquisition or analysis, etc. See the CVI help article titled "Different Approaches to Multithreaded User Interface Programming". (From any CVI window,
goto Help >> Contents >> Search, then enter MODAL in the box titled Type in the word(s) to search for, then select the article title above).
Another option is to use the Windows SDK MessageBox function and specify the type as System Modal.
Add ...\CVI\sdk\lib\user32.lib to your project.
#include in your C file.
Call MessageBox like this.
int nMbReturn;
nMbReturn = MessageBox(NULL,
"Modal style is MB_APPLMODAL.\nThis window is on top the parent window in argument 1.",
"MB_APPLMODAL", MB_APPLMODAL);
nMbReturn = MessageBox(NULL,
"Modal style is MB_TASKMODAL.\nThis window is on top of top-level windows in this application.",
"MB_TASKMODAL", MB_TASKMODAL);
nMbReturn = MessageBox(NULL,
"Modal style is MB_SYSTEMMODAL.\nThis window is on top of all applications.",
"MB_SYSTEMMODAL", MB_SYSTEMMODAL);"
Message 2 of 3
(3,331 Views)

The #include statement was for windows.h.

When the forum moved to forums.ni.com, < bracketed > text like include files got deleted as an HTML error.

0 Kudos
Message 3 of 3
(3,182 Views)