LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

destroy user events

Hi,

I am creating application in Labview 7.0 that uses Event Structures to perform tasks based off of user interaction.  One such task is a typical "Read from File" query that allows the recalling of data sets.  However, if the user cancels out of the "look for file" dialog box I'd like to terminate the rest of the sequence typically fired with that event upon a successful data set recall.

Using the File Dialog "cancelled" output, I can programmatically determine how to proceed. My problem comes when I try to kill the ongoing event.  My attempt at creating this action was to use these vi's: Reg Event->Create User Event->Destroy User Event.  I fed the CtlRef from the currently executing event structure into the "Value Change attribute of Reg Event.  It doesn't work!!  Am I on the right track?  Is there a way to do this?

Thanks for any help

0 Kudos
Message 1 of 6
(2,994 Views)
It doesn't sound like you need to do anything more than put all of your code following the dialog inside a case statement. Since File Dialog returns a True if canceled, just put everything inside the false case and leave the true case empty.
0 Kudos
Message 2 of 6
(2,989 Views)
A case statement could work, although the larger picture is that there are mutiple arrays and sequences where this case statement would have to propogate.  It would be quite messy.  Is their a more elegant way to do this where I can actually cancel the user's generated "event".

Thanks
0 Kudos
Message 3 of 6
(2,981 Views)
I don't quite grasp the whole picture, but instead of using user generated events, could you possibly use messages put into a queue?  That way you can empty the queue or remove whatever elements you want when the user cancels.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 6
(2,977 Views)
If you have your dialog inside the event, then the event has already been fired and processed so there's nothing to "cancel". If you could post your code, someone could look at it. You say you are using sequences. The sequence structure is the first thing that I would recomend you learn to live without.
0 Kudos
Message 5 of 6
(2,970 Views)

Sorry,

I wanted to add some addtional comments about the sequence structure but got pulled away briefly. The sequence structure should be used sparingly if at all. A much better approach would be to use a state machine inside the event. A sequence structure always executes every frame. A state machine gives you the flexibility to freely move from state to state and stop at any time. There are a couple shipping examples of state machines and more on the Developer Zone that you can do a search for.

0 Kudos
Message 6 of 6
(2,965 Views)