LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Discarding popup after a certain time automatically

Hello,
I am creating a popup panel using installpopup and use GetUserEvent to get the event commit from the user. I also need to add an additional feature wherein, this popup panel if no event commit has occured should automatically be discarded after a specified timer interval.
I used a timer to get the time lapse, however as GetUserEvent takes control and waits for an event commit.. i am not able to discard the panel on the condition of the time elapsed for user to hve clicked on an event. How do i program this application.

with gratitude
vivek $
0 Kudos
Message 1 of 2
(2,942 Views)
Instead of using GetUserEvent, simply install the popup and use a loop and some global variables this way:

1. Set global variables to 0
2. Create a callback for the OK, QUIT or whichever button is in your UIR that concludes the panel; in the callback raise a flag (e.g. "OKbutton = 1")
3. In the timer callback raise another flag when time expires (e.g. "timeout = 1")
4. The routine will look as follows:

// preceding instruction up to the popup display
InstallPopup (panelHandle);
while (TRUE) {
ProcessSystemEvents (); // To permit detecting user interface events
if (OKbutton) {
// Set some flag to determine following code behaviour
break;
}
if (timeout) {
// Set some flag to determine following code behaviour
break;

}
}
RemovePopup (0);
// Your code follows here
// ...

This way your code should work the same way as using GetUserEvent but with the additional timeout feature.

Hope this helps
Roberto


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 2
(2,941 Views)