07-22-2011 10:01 AM
07-22-2011 10:16 AM
You need to use 'Create User Event' and their corresponding functions, whenever you will get your desired condition. you can refer few examples from NI code example.
07-22-2011 10:20 AM
Since you need to poll the counter anyway, just do repetitive comparisons and a simple case structure where a non-empty case activates when the condition is met. No events needed.
07-22-2011 10:28 AM - edited 07-22-2011 10:30 AM
You can configure an event case to handle value change events for multiple controls.
Edit: The code capture tool removed the text from the event selector. That should look like this:
07-22-2011 10:30 AM
A counter is typically not a control.
07-22-2011 10:32 AM
Right. For some reason I missed that and only saw the "input by the user" part.
07-22-2011 10:44 AM
07-22-2011 10:55 AM
There is at least one gotcha with the Value(Signaling) property node. Remember that this is not a ValueChanged(Signaling) property. If the control is set to 5 and you write a 5 to it will still cause the event to fire. I realize this will not happen with a counter if it is incremented each time through the loop. Something to be aware of.
07-22-2011 11:56 AM
SteveChandler wrote:
Edit: The code capture tool removed the text from the event selector. That should look like this:
Not so fast my friend. It is the Native LV Snippet creator which mangles your event structure (amongst many other things). Under the hood it uses the 'Create SubVI' method which can lead to many, many headaches. Having developed the Copy/Paste alternative which is now part of the Code Capture Tool I can tell you unequivocally that the CCT would not do that.
Here is the LV version and my homebrew version of a simple event structure.
Notice that I even backsaved to 8.2 for the heck of it. You can not drag it directly in 8.2, but there are ways of using it still. Just trying to show the underutilization of snippet possibilities.
I tried, distinctly in vain, to get the situation improved. Stick to the CCT.
07-22-2011 12:04 PM
Thanks. I am going to install the CCT right now. It has been on my todo list for a while. I usually create snippets to post and also attach a backsaved VI so older versions can open it. Just getting rid of that step makes the CCT worth it but I know there are a lot of other things that the CCT gives you.
Bubye Edit/Create VI Snippet from Selection. It was fun but I am moving on. This was my final native snippet and from now on you will only see me with the newer and sexier CCT.