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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

STOP Data taking ........are you sure ???

Hello,

I want the user to stop taking data but I also want them to have a choice of yes or no or cancel in case they prematurely pressed the stop button without thinking.

These are students using the Vi.

I tried doing this using case structures which works fine if the user says OK but if the user cancels then the dialog message constantly pops up.
0 Kudos
Message 1 of 8
(2,674 Views)
re:???
where is the rest of this thread?
There are a ton of solutions to this problem, but it would help if we knew a bit more about the current program implementation.
For instance, is the stop a latched boolean?  Is the whole program in one spreadout while loop, state machine implementation?  Are you using an event structure to 'read' the stop? Are you using a standard dialog box? ETC.


Paul
0 Kudos
Message 2 of 8
(2,664 Views)
>is the stop a latched boolean? 
YES


>Is the whole program in one spreadout while loop,
All within the same while loop

>state machine implementation? 
None in the Vi


Are you using an event structure to 'read' the stop?
I was trying to do it with a case structure but anything that works is fine


>Are you using a standard dialog box? ETC.
I was using a dialog box but when I choose cancel the box keeps popping up.

0 Kudos
Message 3 of 8
(2,652 Views)
If you attach a simplified version of your code, we could spot the problem and help you fix it.  It the message keeps popping up, your loop is not terminating when it should.  Perhaps a boolean switch control not set to a latch type.  Perhaps the stop loop condition not quite correct.....
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 8
(2,650 Views)

This is basically what I want to do Smiley Happy

If I press cancel the message doesn't go away.

Any method that would allow me to choose yes or no is fine.  Doesn't have to be particularily the way I started to do it.

Message Edited by ugman on 05-30-2007 11:52 AM

0 Kudos
Message 5 of 8
(2,644 Views)
I will refrain from critic on the code, because I think you intoned this is just a sample that illustrates the problem.  To make this example work, then create a local variable, change it to write and stick it inside the case statement with the dialog, wire it to the output of the dialog or drop a false constant in and wire that.
Problem solved. 

Paul
0 Kudos
Message 6 of 8
(2,626 Views)

Your loop should have a timer inside so that the code doesn't use 100% CPU time.  Also, you could put a loop around the whole code, then when you run the vi, it won't start until you click the front panel switch.  Also, you can skip the inverter that feeds your case structure by just exchanging the True/False cases.  See the attached code.

This would be better done if you would use an event structure.  Capture the switch value change event.  Put the message box in the event case.  If the user presses cancel, you can just discard the value change.  No need to write back to a local variable.  Try it.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 8
(2,617 Views)
Thank you all !!!

I will also try using event structures.  I have never used them (newbie) so I have to dig out some labview nooks.Smiley Happy
0 Kudos
Message 8 of 8
(2,613 Views)