ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed ConfirmPopup

Solved!
Go to solution

Hello,

on a user action, I need to display a ConfirmPopup to ask the user if he really wants to stop the running test, but if he doesn't answer within 5s, then I should automatically remove this popup and continue the test.

As the "ConfirmPopup" function in CVI is a blocking call, waiting for a user action, can someone help me to set up this behavior : How can I kill the ConfirmPopup box if I have no answer within 5 seonds ?

Thanks for your help.

Stephan

0 Kudos
Message 1 of 5
(4,277 Views)
Solution
Accepted by topic author snicolay

I see no other easy way of doing what you need than designing your own message panel and use InstallPopup to install it as a modal window, next create a loop with GetUserEvent to trap button press and a time check to handle the timeout.

 

Otherwise you could use a separate timer callback to handle the timeout and see if calling FakeKeystroke () function can make the message popup disappear: I never attempted such a solution, though.



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 5
(4,274 Views)

Thanks Roberto,

I didn't want to define a new panel for such a small thing but, yes, I think that I'll use GetUserEvent on an own defined panel, as I don't know the behavior of a fake keystroke if the user already answered and made the panel disappear.

I just hoped a more "elegant" solution could exist.

Thank you for your contribution.

0 Kudos
Message 3 of 5
(4,271 Views)

Roberto Bozzolo wrote:
Otherwise you could use a separate timer callback to handle the timeout and see if calling FakeKeystroke () function can make the message popup disappear: I never attempted such a solution, though.

This works fine. FakeKeystroke(VAL_ESC_VKEY) results in a language-independent 'No' response.

Message Edited by msaxon on 22-12-2009 05:01 PM
--
Martin
Certified CVI Developer
0 Kudos
Message 4 of 5
(4,269 Views)

I have created a small project to show both methods to obtain a timed MessagePopup. The example using MessagePopup () creates a timer to handle the timeout; the timer is discarded immediately after the command, so that if the user actually presses the 'Ok' button then non keystrokes will be sent to the application.

Take a look at it and feel free to comment it or ask clarifications if needed.

 



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 5 of 5
(4,250 Views)