Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
2 ratings:
 4 out of 5     Rate this Document

Event Structure Does Not Capture the 'Value Change' Event When Values are Programmatically Changed

Primary Software: LabVIEW Development Systems>>Full Development System
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>Base Package, LabVIEW Development Systems>>Professional Development System

Problem:
Using an Event Structure, I configured a case to execute when there is a value change of an indicator on my front panel. In my VI, the indicator is sent a value from another part of my code. When I run the VI, I can see the indicator value changing, but the code in the event case that I configured never executes. Why is the Event Structure not registering the value change of my indicator?

Solution:
The Event Structure only registers events generated by direct user interaction with the front panel. In this example, the indicator value is changed programmatically, thus LabVIEW does not capture the Value Change event.   Furthermore, Value Change events do not occur if you use VI Server, global variables, local variables, etc. to change VI or front panel objects programmatically.

There is one exception: Events for controls and indicators can programmatically be generated with a property node, using the property Value (Signaling). This write-only property creates an event that acts like a front panel value change each time it is written. Beware of using this property in a loop, however, because if it is written in each iteration of the loop, it will generate a value change trigger for each iteration, regardless of whether the value was actually changed. 

See the figure below and the attached VI for a demonstration. 

The objective is to detect the value change of the indicator Event Source, which is intended to be wired up to the control .  Rather than wiring Numeric to Event Source outside of the event structure, this is done inside the event structure for Numeric's value change so that the Event Data Node NewVal could be used to prevent a change in Event Source being sent every single time.  Immediately after Numeric has a value change, case 2 of the event structure is executed, and a value change of Event Source has been flagged for the next iteration of the while loop.  Case 1 of the event structure then executes, seen below.

In LabVIEW 7.1 or earlier, refer to the LabVIEW User Manual (linked below) for more information on registering for events. In LabVIEW 8.0 or later, refer to the User Events topic in the LabVIEW Help (linked below).



Related Links:
Product Manuals: LabVIEW User Manual
LabVIEW Help: User Events
Developer Zone Tutorial: Event-Driven Programming in LabVIEW
KnowledgeBase 30BENK7Y. Value Change Event Case Not Reading the Correct Value

Attachments:
Indicator Event821.vi
Indicator Event 7.1.vi




Report Date: 03/04/2008
Last Updated: 03/04/2008
Document ID: 4J3DI2MA

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit