LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

PopUp window not on the top

Hello,
I have programmed a PopUp window (programmed in LabWindows compiled as dll). I call this dll in teststand and somtimes (often) this PopUp window is in the background (behind my OperatorInterface). What can I do that this window is always shown on the top?
 
thank You
regards samuel
0 Kudos
Message 1 of 11
(8,315 Views)

This is an occasional issue that I have seen too, though not with a DLL. Is your popup related to some slow I/O - perhaps a sluggish network drive? 

I can't provide real answers, but you may want to review this thread for ideas that may work for you.

(Also: this thread  and  this thread)

Please let us know if you discover anything new.

--Ian

0 Kudos
Message 2 of 11
(8,301 Views)

Hello,

I also have a problem with MessagePopup windows, or windows that are displayed using the InstallPopup function. I have the feeling that these windows do not stay on top of all other panels of the applications all the time. Like when I first display a message using MessagePopup and then change the value of a control on my Main Panel (before user hits the OK button), the Popup Message disappears behind the Main Panel.

I think that Popup Panels should always stay on top (floating) of the other panels of the application, since the other panels can not be operated and the application might seem to have crashed... So even when a panel is displayed using InstallPopup and then an other panel is displayed using (DisplayPanel), the Popup Panel should always be on top of the other panel. This would make life a lot easier Smiley Wink

0 Kudos
Message 3 of 11
(8,287 Views)
I think we need to be clear in this discussion: InstallPopup displays a box as a modal dialog box, meaning not only is it supposed to be on top, but all input to other panels in that program is blocked until the popup is taken care of (closed). And indeed if a button on the popup causes another panel to be displayed with DisplayPanel(), that panel can't be used until the popup is removed. The exception is that another popup on top of a previous popup is operable.
 
Being modal is central to the problem behavior, but I'm unsure about the floating style. Panels can be floated on top, but not necessarily be modal.
 
The bottom line is that I think we all want to find or see an example program that reproduces this modal dialog box behind the main window!
 
(I should also add that if I recall correctly, I once saw a non-CVI app have this problem - a popup behind the main window - so we may well be tripping on a rare OS (XP) issue, rather than a CVI one.)
0 Kudos
Message 4 of 11
(8,264 Views)
Hello Wim,

In fact popup panels are expected to stay in front of other panels. I completely agree with you. So, what you are describing is not expected behavior.

I tried it myself, and couldn't reproduce it, so I must be doing something slightly different than what you did. This is what I did: I displayed a popup using MessagePopup on top of another panel, and without touching the popup I changed the value of a control in the main panel programmatically (using a timer that I had placed in the main panel). I saw the value change (it was a string control) but the popup did not disappear behind it. Is this more or less what you are doing? Are there multiple threads involved, in your case?

Thanks,
Luis
0 Kudos
Message 5 of 11
(8,264 Views)

Hello Luis,

thanks for the response. I also tried to reproduce it in a simple project, but I did not succeed. Everything works as expected and the messages stay on top of the other panels. In my original project, I am using several threads, but the popup windows are always loaded from the main thread. I will have to dig some deeper into my code, but unfortunately I do not have any time now to do so. I will come back to you if I am able to reproduce the strange behaviour.

0 Kudos
Message 6 of 11
(8,233 Views)
On re-reading my last post, it seems I may have unintentionally discredited Wim's input. Sorry, Wim, and thanks Luis for coming to his defence!
 
I too built a test program and was unable to duplicate the issue, even with some intervening long read/write tasks and several variations.
 
I raised this with a non-CVI developer, and he commented that he once had had a Windows confirmation dialog box hidden behind a window when doing a drag and drop operation in Windows XP. So I continue to suspect an OS-level issue is at play here.
 
I look forward to further posts from anyone who can help us..
 
--Ian
0 Kudos
Message 7 of 11
(8,221 Views)
Hello again, Wim and Ian.

One thing that could be a factor is the multithreaded nature of Wim's application. Popup panels are only modal with respect to other panels that are loaded or created in the same thread. Wim mentioned that all his message popups are displayed in the same thread. Presumably the main panel is also loaded in the same thread. But if there are any times in this application in which a secondary thread might create or load a panel, then this could be the explanation.

Luis
0 Kudos
Message 8 of 11
(8,220 Views)
Now here is an interesting clue, which I thought I had seen before, but wanted to be sure: In the CVI IDE (8.0.1 (356) ) when I pressed
<Ctrl>-M to build the debug executable, the popup that announces that CVI is done came up behind the maximized CVI IDE window!  The title
bar of CVI was dimmed. Pressing Alt-Tab to toggle to another app, and then Alt-Tab to get back to CVI restored the popup to the front.
 
What follows is a detailed description for anyone who cares to investigate.
 
The popup title is "LabWindows/CVI Message" and the message reads ' " c:\.....myapp_dbg.exe" successfully created'.
 
This particular project is large, has many source files, uses all local storage, and it is on a PC with a very slow hard drive.
 
I couldn't repeat it consistently without some trial and error: It was necessary to first switch to another app (Firefox) then back to CVI
before compiling. No source code changes were required each time. I did not even run my compiled application. I closed all source code
windows and it still happened. I just hit ctrl-M and didn't switch to any other app - I just watched it.
 
When the problem occurs, the pointer turns to an hourglass as compiling/building starts, then after a few seconds the CVI icon in the left corner
in the title bar turns to a blank window icon and simultaneously the "Restore Down" icon in the right of the title bar dims, then after a few seconds the title bar of
CVI goes dim and I see a brief flash of the poup, but it disappears. The icon in the left corner returns to the proper CVI icon, and the
mouse pointer restores to the default, but the title bar stays dimmed.

When CVI is not maximized, the problem still occurs, but the blank window icon does not appear in the top left. However the "Maximize"
icon does dim at that moment.
 
As I pared things down by closing Outlook, Excel, Firefox, etc.,  I was able to get to the point where I only had IE 6 open to this forum,
and CVI. But the taskbar showed 3 items - including one "ghost" entry for my app. See the attached task bar image. The Task Manager only
showed 2 apps: IE and CVI. Clicking on the "ghost" task bar item did nothing.  Exiting CVI and then clicking on the "ghost" task bar item
caused it to disappear.
 
Next I relaunched CVI - rebuilt the debug exe (no popup problem), then switched to IE and back CVI, rebuilt the debug exe again and the
problem was back.  As before it was now always consistent - if I switched apps back and forth, then rebuilt, I'd get the popup behind. I took
a screenshot (attached), with a small off-center CVI window so you can see the popup behind.
 
Now after editing my screenshot can't repeat it at all.  But I have the screenshot to prove it!

I'm using Win XP Pro (Build 2600.xpsp_sp2_gdr.050301-1519).
 
--Ian
Download All
0 Kudos
Message 9 of 11
(8,153 Views)

This may be late answer, and is probably what was described indirectly in all the messages above, however I will add my two cents worth.

 

If the timer function that displays the popup is an asynchronous timer, then it runs in a different thread than the main program.  I suspect that the main panel and the popup panel are operating in two separate threads, which means that either one can "hide" the other one.  I have found that it is best to load/display/installPopup/ etc. all panels, including the built-in CVI message/confirm/fileselect popups in the same thread.  This is good design anyway because it prevents the UI from interfering with the timing of the other threads.


If you have a separate thread that needs to display a popup that works like a modal dialog box over all of your application displays, you can do this by using PostDeferredCallToThread to a run a function that displays the popup in the main thread. 

0 Kudos
Message 10 of 11
(6,825 Views)