LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

uir does not display correctly upon execution

I am experiencing a problem with the display of my uir when I run my .exe.  When the uir first comes up, certain elements don't display at all and the contents of the window behind can be seen.  I am attaching a screenshot to show you the problem.  If I minimize the window and restore, the panel is displayed correctly.  The problem occurs on multiple PCs and with different versions of CVI (I have 7.1 but it also occurs in 8.1).

-Joel
0 Kudos
Message 1 of 7
(4,128 Views)
Hi Joel,

If you bring the UIR into a blank project and load the panel, do you still see the behavior? Also, do you have a loop in the code that runs at start up? What happens if you add a call to ProcessDrawEvents right after calling DisplayPanel?

Regards,
0 Kudos
Message 2 of 7
(4,082 Views)
Hi James,

I tried a few of your suggestions.  I loaded the panel into a new, blank project, but saw the same thing there.  Adding ProcessDrawEvents() after DisplayPanel() also had no effect.  You asked about a loop in the code that runs at start up.  I have several loops in my main() routine, but can you be more specific as to what you want me to look for?

Thanks,
Joel
0 Kudos
Message 3 of 7
(4,042 Views)
Hi Joel,

The first question is: how much work are your loops doing?
The second question is: where are the loops?

If the loops are between DisplayPanel and RunUserInterface, the behavior you are seeing does not surprise me. If you do not call RunUserInterface, the program will never call ProcessDrawEvents and the screen will never refresh. Depending on how much work the loops are doing (especially if it is continuous throughout the life of the program), you may want to consider spawning a second thread so the code doesn't block before RunUserInterface. If you do decide to take a multi-threaded approach, I suggest you look at many CVI help topics devoted to this subject, especially "Different Approaches to Multithreaded User Interface Programming"

Regards,
0 Kudos
Message 4 of 7
(4,012 Views)
Hi James,

I had a chance to look at this some more.  The loops in my main() are not relevant to the panel display.  And RunUserInterface() was being called after DisplayPanel().  I inherited this code from someone else and noticed that he had a call to SetPanelAttribute(m_pnMain, ATTR_WINDOW_ZOOM, VAL_NO_ZOOM) in there, between DP and RUI.  I couldn't figure out what that was put in there, but when I commented it out, the panel didn't display at all.  For some reason, I had the idea to put in SetPanelAttribute(m_pnMain, ATTR_VISIBLE, 1).  It seems like the panel was somehow set to invisible, although I can't find where that is being set.  After adding that call to make the panel visible just before RunUserInterface(), the panel now comes up correctly the first time, all the time.

-Joel


0 Kudos
Message 5 of 7
(3,948 Views)
Hi Joel,

That is really odd that the panel needs to be set to visible. Does the same behavior occur if you create a new project from scratch (if you use the User Interface Application template for example)?

Regards,
0 Kudos
Message 6 of 7
(3,920 Views)
Hi James,

I'm not going to be able to spend any more time on this.  I found a solution that works for the time being, even if it is a kludge.  If I see this occur again on future projects I will probably be able to spend more time investigating.

Regards,
Joel
0 Kudos
Message 7 of 7
(3,882 Views)