ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
12-22-2009 09:58 AM
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
Solved! Go to Solution.
12-22-2009 10:42 AM
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.
12-22-2009 10:53 AM
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.
12-22-2009 11:00 AM - edited 12-22-2009 11:01 AM
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.
12-22-2009 01:51 PM
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.