LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cancel button on 2 button dialog to stop execution of vi

I am trying to use the cancel button of a 2 button dialog box to stop execution of a vi. This dialog box will be in the first box of a sequence structure that contain a read from file. I want the vi to either stop or restart with a new file name for read.

I am trying to create configuration files and want to make sure the user has opened the correct format of a file.
0 Kudos
Message 1 of 2
(3,133 Views)
What you need to do is to replace the sequence structures and use a state machine architecture. Sequences cannot be interupted and stopped (at least elegantly). Make the first case of the state machine the file read and if the file is incorrect, you specify the next state as the file read again. State machines are basically case statements inside a while loop and the case selector is wired to a string or enum. States are passed between the cases via a shift register or by writing to a queue inside the case. There are numerous examples of state machines available. Check out the example called Queued Message Handler.vi in the examples included with LabVIEW. There are others in the LabVIEW example program database.
Message 2 of 2
(3,133 Views)