LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with InstallPopup redrawing windows

I have a huge CVI application (CVI 2013) with many open windows displaying data.  All the windows are defined as top most (i.e. not child panels), and all have the ATTR_FLOATING set to VAL_FLOAT_APP_ACTIVE.  The operator will arrange the windows according to the data they need visible - many will be overlapping etc. 

 

If at any time the function "InstallPopup" and then "RemovePopup" are called by the application, all the floating windows are re-drawn, and not restored to the same z-plane order that the operator has placed them in. They seem to be redrawn to the original order they were first displayed in.  Does that make sense?  This appears to be something inherent in the InstallPopup and RemovePopup calls. What I need is for the z-plane order that the operator has placed the windows in to be maintained.  Is there a way to save/restore the z-plane order of the top most windows?  Or is there something else I can use besides InstallPopup to create a modal dialog that won’t redraw all the windows?

Thanks!

Angie

0 Kudos
Message 1 of 7
(2,566 Views)

Hi, Angie,

This example explores installing popups to certain coordinates, but I think this is not really along the lines of what you need. You may want to consider restructuring your dialogs into tab pages or something along those lines.

 

How Can I Adjust the Position of a LabWindows/CVI Popup Dialog?
http://digital.ni.com/public.nsf/allkb/3F665DC28F9A2324862569F600051403

0 Kudos
Message 2 of 7
(2,528 Views)

Thanks, but I really need to use modal dialogs.  I guess I wasn't very clear when describing the problem.  It's not the x,y position on the screen that I need to control, but the z-plane position of the panels.  I've attached a small CVI project that will demonstrate what I'm talking about. 

I can't believe this behavior is acceptable and no one has had this issue before!  Or maybe I'm just doing something wrong.   I'm hoping that someone could tell me that it has been fixed in versions of CVI  post the 2013 version.  I think if I could show that this was the case my management would approve of upgrading to the latest version of CVI.

Thanks again

Angie

0 Kudos
Message 3 of 7
(2,521 Views)

In an earlier project (almost 20 years ago Smiley Surprised) I also had the wish to maintain the z plane ordering of the panels, e.g. after minimizing and redisplaying the main application. This functionality does not natively exist so I ended up writing a PanelManager function that I used instead of DisplayPanel. This function simply (more or less) did all the book keeping (panel minimized, z plane order...) with the help of the following structure 
{
    BOOL full_size;
    short int position_left;
    short int position_top;
    short int zplane;
};

In short, I would tend to encourage you writing such a function; I managed so it should be possible rather easily Smiley Wink

0 Kudos
Message 4 of 7
(2,517 Views)

Hi Wolfgang,

Thanks for the idea.  I guess that's basically what I'm trying to do.  I have tried reading the current window z-order by using the WinApi  call "GetWindow" and reading the previous window handle (I maintain these values in an array of structures similar to what you suggested for each open panel):

 

prevPanelHwnd = GetWindow ((HWND) hwnd, GW_HWNDPREV);

 

then after displaying the panel with DisplayPanel or InstallPopup I attempt to restore the z order (of all open panels) by calling SetWindowPos, and setting the previous window handle.  But this doesn't seem to work. I'm using the following flags in the call although I've tried other combinations.  If anyone can see something I'm doing obviously wrong please let me know.  Or maybe there's a better WinAPI function for setting the z-order?

 

SetWindowPos ((HWND)hwnd, prevPanelHwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOOWNERZORDER); 

 

Thanks!

Angie

0 Kudos
Message 5 of 7
(2,498 Views)

Hello Angie,

 

I used the functions provided by CVI...

Activating one panel actually means setting the z-plane order of the selected panel to a maximum index, then sorting the window structure into ascending numerical order of the z-plane using Shell's method, reenumerating the z-plane order and then discarding and rebuilding the panels programmatically in the given z plane sequence.

0 Kudos
Message 6 of 7
(2,493 Views)

Ok - I get it now.  I didn't actually discard and rebuild the panels in the desired order, I was just trying to re-activate or repaint them....I'll give that a try.

Thanks!

0 Kudos
Message 7 of 7
(2,490 Views)