LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ValueChanged event programmatically ?

Hallo newsgroup,

desperately I must know this.

A control generates a ValueChanged event if I enter a new value.

No I have tried this: I have a control in VI1. In VI2 I open a VI reference
to VI1, PropertyNode Panelrefnum PropertyNode Controls[] PropertyNode
WriteValue to the refnum of the control.

This works fine, I can write a value to control in VI1, it changes
obviously but it doesn't generate a ValueChanged event. Is this a bug or a
feature? How can I do this?

Oliver Friedrich
0 Kudos
Message 1 of 7
(3,762 Views)
The event is only triggered by changes from the GUI.
In LV7 the Value (Signaling) property was introduced though and if you use that it will generate an event.
Message 2 of 7
(3,762 Views)
Hi,

You could also create a user event. The Value Changed event can always call
the user event, and so can the sub VI. Put the program logic in the user
event, so it's executed in both cases.

Regards,

Wiebe.

"Mads" wrote in message
news:506500000005000000B66D0100-1079395200000@exchange.ni.com...
> The event is only triggered by changes from the GUI.
> In LV7 the Value (Signaling) property was introduced though and if you
> use that it will generate an event.
Message 3 of 7
(3,762 Views)
> This works fine, I can write a value to control in VI1, it changes
> obviously but it doesn't generate a ValueChanged event. Is this a bug or a
> feature? How can I do this?
>

As others said, this is a feature. If value change events were to be
fired each time a programmatic change occurred, it was be all too easy
to get into infinite loops or infinite recursion. So it was defined
that the events are for UI notification, to tell your program what the
user is doing, whereas your program knows that what it is doing. If you
want shared code, user events are an option, but even better is to use a
subVI.

Greg McKaskle
Message 4 of 7
(3,762 Views)
Hello Oliver,

What Greg stated above is entirely true. The design of the Value Change property in the Event case was intentional. However, there is a way to programmatically �fake� the Event case into thinking that a Value Change event was initiated by a front panel user. This is a feature that was added in LabVIEW 7.0, so it is unavailable in previous versions of LabVIEW.

To programmatically trigger this event, create a property node from the front panel control you wish to change. Setting the �Value (Signaling)� property of this control changes the value AND generates a Value Changed event. This property was specifically designed to allow programmatic generation of the Value Changed Event.

Hope this helps! Let me know if there is anything I can help wi
th or clarify.

Ken S.
National Instruments
Message 5 of 7
(3,763 Views)
I am trying to do the same thing but it doesn't seem to work.  I want to use the event structure to start a timer and warn when the time has elapsed.  This way I don't have to constantly poll the when I am no using it.  I have attached some code that contradicts what you are saying.  Maybe I am missing something.  Maybe there is a better way to start a timer and be signaled when the timer is up.
 
Thanks.
Matt
0 Kudos
Message 6 of 7
(3,471 Views)
The event case needs to be triggered by "value change", not "mouse down".
Message 7 of 7
(3,437 Views)