LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Warning Stop

Hi,

 

I would like to get some advice on how to create a stop warning when I stop my program. I tried some ways but I am unable to reset my Stop button to false when I click No.

Thanks!!!

main program.png

subvi.png

0 Kudos
Message 1 of 5
(1,668 Views)

Use an Event Structure for your GUI.  In the stop value change event, put your warning dialog.  If accepted, set a global variable.  If reject, do not set it.  Given what you have shown, I would use a global variable for the stop condition.  Your second loop can just poll the stop global variable instead of getting the value through a property node.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(1,661 Views)

@crossrulz wrote:

Use an Event Structure for your GUI.  In the stop value change event, put your warning dialog.  If accepted, set a global variable.  If reject, do not set it.  Given what you have shown, I would use a global variable for the stop condition.  Your second loop can just poll the stop global variable instead of getting the value through a property node.


I agree with the answer provided but would recommend propigating your stop condition through some other means than a global variable. I would use a notifier or user event instead. While global/local variables can be used safely they can be quite problematic if they are not used carefully.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 5
(1,643 Views)

Hi Crossrulz,

 

The code with property node is my subvi. I am trying to stop it from my main program. In my subvi there is some process when I stop the program, I used the reference to stop the subvi too. I want to make the subvi process "pause", so I am actually thinking if I should put the warning dialog in my subvi?

0 Kudos
Message 4 of 5
(1,641 Views)

I like to keep all of the user interaction in 1 section of code.  So I would keep it in the event structure.  What you can do, though, is have a messaging system of some sort (Notifier would probably be best).  The messenger should have at least 3 messages (Run, Pause, Stop).  When the stop button is pressed, send the Pause.  If the user cancels, send the Run.  If the user accepts, send Stop.  Have your subVI respond accordingly.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(1,636 Views)