I've programmed a labview vi to add a field to a list view when a boolean variable value is changed. I used an Event case structure (change value event) to determine when a variable value is changed,it works when I force the boolean control with my mouse click, but It's not working when the value of the variable is changed by OPC. What should I use instead?
Solved! Go to Solution.
Value change events are based on user interaction (or programmatically firing the even based on the value (signalling) property node.) It is not based on a control changing via a regular property node, local variable, terminal, or any other programmatic connecito0n or binding.
You should just poll the variable and determine when it changes. In that case, you can then use the value (signalling) property node to fire the event case.
Thanks for your help RavensFan,
I tried to put the signal value in my main loop and that made my front panel to freeze. I found that I shouldn't put it in each itterration of the loop. But what is the best practice to implement this method. Should I use an other variable for each of my variables and check everytime when the value of the variable is changed? or there is other wise solutions for it?
I don't know whether it should cause your application to freeze.
But one thing about the value change event is that it is a little bit misnamed. The value doesn't have to actually change for the event to be fired. A user entering the same number into a numeric control as was already there is considered a value change. Programmatically writing the same value to the Value (Signalling) property node technically isn't change the value, but the act of writing a value to that node is "Signalling", for the value change event to occur.
So if you are writing to it every loop iteration, you are generating that event every loop iteration. If you really only want to fire the value change event on an actual difference in the value, then put the property node in a case structure that only executes when the value to write is not equal to the previous value.