LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

What could make HidePanel() not hide the panel? (2017)

We pop up a splash screen panel on startup:

 

if ((g_PanelSplashScreen = LoadPanel (0,  "PanelSS.uir", PANEL_SS)) < ZERO) return NEG_ONE;
SetCtrlVal (g_PanelSplashScreen, PANEL_SS_VERSION, _TARGET_PRODUCT_VERSION_);
SetCtrlVal (g_PanelSplashScreen, PANEL_SS_STATUS, "Loading user interface...");
DisplayPanel (g_PanelSplashScreen);

 

...and then at the end of the routine we hide it:

 

// Hide splash screen panel.
HidePanel (g_PanelSplashScreen);

 

But it often sticks on the screen and does not hide. Clicking on it makes it disappear.

 

If I run it in the Debugger (either Release or Debug build) it seems to work. But then if I run the .exe that was produced for the debug session, the panel does not go away. Weird.

 

Any thoughts on what could cause this?

0 Kudos
Message 1 of 7
(323 Views)

Try to use  SetPanelAttribute(panel,ATTR_VISIBLE,0) ;

Message 2 of 7
(299 Views)

@GabelDaniel wrote:

Try to use  SetPanelAttribute(panel,ATTR_VISIBLE,0) ;


Ah, I had not thought of that.

 

I gave that a try this morning, and no change. BUT, it did lead me to what may be a solution.

 

We display the pop up, then eventually call a function that does startup things, and I SetCtrlVal() to a text field on the screen, giving status of what is going on. At the end of that last function, I would HidePanel(). Then, it goes back to main and displays something like "Starting user interface..." right before RunUserInterface(). I thought maybe modifying that panel was making it display. I commented that out, and still no change.

 

But, moving the HidePanel() there "seems" to work -- at least, I have tested it a few times this morning with no stuck splash screen. I am not sure why a HidePanel() only works "sometimes" in the function, but I'm going to test this more and see if this finally makes this panel hide properly.

0 Kudos
Message 3 of 7
(278 Views)

Have you ever tried trapping the return code from HidePanel ()? It could return a meaningful value that sheds some light on what's going on.

Just my 2c



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 7
(247 Views)

@RobertoBozzolo wrote:

Have you ever tried trapping the return code from HidePanel ()? It could return a meaningful value that sheds some light on what's going on.

Just my 2c


Yes, early on, when this first started happening, I added error checking to that call, but it just blows on by.

 

Also, don't non success errors trigger a breakpoint, by default, when running in the debugger? I know SetCtrlValue/Attribute will break if the panel handle is wrong and the control ID is if the wrong data type. 

0 Kudos
Message 5 of 7
(237 Views)

Roberto, you beat me to this idea.  I was thinking the same thing.  And this is generally a great, easy troubleshooting thing to do with all library functions!  Has rescued me more times than I can count.

0 Kudos
Message 6 of 7
(201 Views)

@AllenInIowa  ha scritto:

Also, don't non success errors trigger a breakpoint, by default, when running in the debugger? I know SetCtrlValue/Attribute will break if the panel handle is wrong and the control ID is if the wrong data type. 


Check Run >> Break on >> Library Errors menu item: it is a bit obscure to me when the IDE breaks if this item is not checked.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 7
(177 Views)