LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cancelling the "Prompt user for input" tool

I have placed the "Prompt User for Input" tool in my program and I have clicked on the checkbox to include a second button named "cancel". But when you run the program and you click on the "Cancel" button when the "prompt user for input" tool is up, it does not get out of the prompt command. Instead it keeps popping up the "prompt user for input" tool.

How do I set up the tool so that when the operator clicks on "cancel" it will stop prompting the operator?
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 1 of 12
(4,836 Views)
You don't configure the Express VI, you have to process the output OK to handle the cancel condition. It sounds like you have it some loop that keeps calling the function over and over again.
0 Kudos
Message 2 of 12
(4,824 Views)
That's what I thought I had done in my program. I set it up so that if the "OK" output was equal to boolean false, it would jump to an entire different case. However, it's not jumping to that case, it just keeps popping up the same prompt window. I'm pretty sure there is some kind of right-wing conspiracy behind this.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 3 of 12
(4,821 Views)
Post your VI. Right-wing or not, it'll help to solve your problem.
0 Kudos
Message 4 of 12
(4,816 Views)
My entire program is pretty big, so I'm including just the section that contains the prompt. My code contains a series of stacked cases, and this chunk of code is nestled inside case 1. What I'm trying to do is if the operator selects "cancel" while the prompt is up, it will jump to case 0. If the input is valid, it will jump to case 2. There is more code, but I've only included this part to keep it clean.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 5 of 12
(4,812 Views)
The Prompt Express VI is written such that you must enter something inside the text box or it will keep popping up. I ran your example and if I did not enter anything, it did not matter which button I pressed, the thing popped up again and again. When I entered some text, I could press OK or Cancel and the rest of the program started executing. Pressing Cancel makes the OK output False as expected. Perhaps you need to write your own message popup vi using a string control and buttons placed inside a while loop. Clicking either button exits the loop. You could also add some checking to see if the string is not empty if the OK button is pressed. If the Cancel button is pressed, just exit the loop without checking the string.
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 12
(4,796 Views)
The termination of your while look doesn't depend on the ok output of the input user for input.
You're using that output to do something outside the cycle, what happens is that the stop condition of the cycle is not achieved and the cycle is popping the input again.
You have to put an OR after that =1 that you have connected to the cycle terminator, so it will end the cycle if the user presses Cancel.
Look at the small change I made:

Hope it helps,
Paulo
0 Kudos
Message 7 of 12
(4,793 Views)
Thanks tbob. That was it - it works only if you enter something into the text window. It wasn't a right-wing conspiracy after all. It was the liberal media.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 8 of 12
(4,790 Views)
That was the next thing I was gonna take care of - thanks for taking care of it for me, Paulo!
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 9 of 12
(4,788 Views)
Strange...
I can cancel without filling the text box!
I have LabVIEW 7.1., it's probably because of that...
Regards,
Paulo
0 Kudos
Message 10 of 12
(4,786 Views)