From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

InstallPopup a panel but it not be displayed immediately

Solved!
Go to solution
Hello, I'm using installpopup to popup an error panel on the main panel, but sometimes the popup panel can not be displayed, I click the task bar icon, then it would be displayed. The panel loading and popup code is here: Panel Loading: //Main panel loading if((pnlHndlGONOGO = LoadPanel(0, "TestExec.uir", PANEL_GNG)) < 0)         return -1; //Error panel loading if((pnlHndlError = LoadPanel(0,"TestExec.uir",PANEL_ERR)) < 0)         return -1; Panel popup: lTemp = SetBreakOnLibraryErrors(0); while(-43 == InstallPopup(pnlHndlError))     {         DelayWithEventProcessing(0.11);     } SetBreakOnLibraryErrors(lTemp); Does anyone knows what happened? Thanks.
0 Kudos
Message 1 of 10
(3,708 Views)

I don't understand why are you trapping that -43 error that is not supposed to happen on the first issue of InstallPopup.

If you want to wait for the user to press a button to dismiss the popup before proceeding you could for rxample place a Ok button without callback on the popup and do the following:

lTemp = SetBreakOnLibraryErrors(0);
InstallPopup(pnlHndlError);
while (TRUE) {
	GetUserEvent (1, 0, 0);
}
RemovePopup (0);
// Next code to execute after popup is dismissed


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 2 of 10
(3,695 Views)
Hi, Roberto, Thanks for your reply. Indeed, in my program, I don't waitting for user's response after I popuped the panel. I using an OK button's callback function to removepopup. So, sometimes the panel may be popup when it has been popuped, I should wait for user click the OK button to remove the popup first at this moment. BTW, I have tried the code you provided, but the issue still exists. It seems like the panel has been poped up, but just couldn't see it. I should click the taskbar icon or the main panel to let it visible. Thanks.
0 Kudos
Message 3 of 10
(3,691 Views)

Is the program multithreaded? If so and you create the popup in a thread other that the main one the panel may not be visible.

Can you create a small example similar to your actual app that exhibits the same behaviour for us to examine it?



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 4 of 10
(3,689 Views)
I don't use multithread, I have tried to built a small progam to confirm this iusse, but the issue does not occur.  And the fact is, I even can't let it happen on my own PC with the original program. This issue was been founded by our customer. I used an windows system timer in the program, does this could case the problem?
0 Kudos
Message 5 of 10
(3,687 Views)

Which windows timer are you referring to? If you are using CVI Asynchronous timers which are built on top of multimedia timers, then yes, they are multithreaded. Which means the popup should not be issued from inside the timer callback.



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 6 of 10
(3,680 Views)
Both windows system timer (SetTimer) and CVI Asynchronous timer (main panel's timer control) are using in the program, but there's no error panel installpopup in the timers' callback. I still tring to let it happen on my PC, if I have new findings, I will tell you.  Thanks for your warm concern!
0 Kudos
Message 7 of 10
(3,671 Views)
Solution
Accepted by topic author BanceLiu

OK, keep us informed on this.

BTW, a UI timer (i.e. right-click on a panel and create a timer control) is NOT an asynchronous timer but is handled by the main thread (and is not guaranteed to run always and with a regular pace: there may be events that block or delay the event scheduling).

CVI Asynchronous timers are handled by the asynctmr.fp instrument which is normally located in <cvi folder>\toolslib\toolbox folder and must be loaded either in the Library menu or in the Instrument one.

See this knowledgebase entry and the relevant help page (and functions list).



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 8 of 10
(3,665 Views)

Hi Roberto,

I am sorry for gave you wrong info, I am not using  CVI asynchronous time, I am using UI timer and windows timer (created by SetTimer), and the windows timer may installpopup the error panel at some special condition. I think the windows timer maybe also multithread, and based on your advise, I changed it to a UI timer. The good news is our customer simply tested the app I modified, the issue doesn't happen again. They are doing cycling test now. I will tell your the final test result later.

Again, thanks very much!

0 Kudos
Message 9 of 10
(3,658 Views)

Hi Roberto,

 

Thanks for your help!

 

Our customer has been finished the test. After we changed the timer to a UI timer and wait for user's click to removepopup, the issue never happened again!

 

0 Kudos
Message 10 of 10
(3,595 Views)