LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Value (Signaling) property and programmatically generate value change event?

Hi there !

I have a simple ActiveX client program (written in C) which uses LabVIEW as ActiveX server, loads the specified VI, is able to set a control value and run the VI.

When I use SetControlValue ("controlLabel", value), the corresponding control indeed is set to the specified value and, if I use polling, the VI detects that the value has changed and performs the required action.

Now I want to take advantage of the event-driven capability since LabVIEW 6.1 and extended in LabVIEW 7.

It is stated that "Several other event-related enhancements are present in LabVIEW 7 Express. You now can programmatically generate value change events by updating a control's value using the new
Value (Signaling) property."

I'd like to know if I can change the Value (Signaling) property of a control from an external C program, and if so, how.

If not, I'd like to understand what is meant by "You now can programmatically generate value change events by updating a control's value using the new Value (Signaling) property." and how this is done.

Thanks !
0 Kudos
Message 1 of 16
(4,728 Views)
Hello Frans,

Thank you for contacting National Instruments.

The Value (Signaling) property allows you to change the value of a control or indicator programmatically on the block diagram, while also generating a value-changed event that can be captured for further use in the program. The following link provides an example VI that demonstrates exactly how this property works:

http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=C22A168F95CC3450E034080020E74861&p_node=%20DZ53012&p_submitted=N&p_rank=&p_answer=&p_source=Internal

You can change the Value (Signaling) property of a control from an external C program by changing the value of another control that is wired to the property. Referring to the example VI from above, if you use yo
ur ActiveX client program to set the value of Slide2, you will change the Value (Signaling) property of Slide1.

You can obtain a list of available ActiveX Methods and Properties for LabVIEW by opening LabVIEW and selecting Help >> VI, Function, & How-To Help.... Run a search using keyword "ActiveX." I believe the function call you may want to use is as follows:

object.SetControlValue(controlName, value)

I hope this helps!

Matthew C
Applications Engineer
National Instruments
0 Kudos
Message 2 of 16
(4,728 Views)
Matthew,

the link you provided does not seem to work (at this very moment), but your explanation was sufficient to change my example code and have my ActiveX client generate an event. Great !

Thanks a lot for your help.
Frans.
0 Kudos
Message 3 of 16
(4,728 Views)
Matthew,

I was a bit too enthousiastic ... 8-(

Your proposal works when the VI is started by the ActiveX client, i.e. an event is generated immediately.

However, once the VI runs, the value of the control connected to the Value (Signaling) property (set either manually or via the Active X client) is only transfered from the control into the property (and generates an event), if the control and property are placed in a while loop. This loop contains a wait object, such that the VI does not consume all CPU time. At that moment, the approach tends to be more polling-based than event-driven. Also, the response time depends on the wait value set in the while loop (and the time it takes to perform the actions within the while loop).

Another disa
dvantage is that this approach will generate an event during each iteration of the while loop (generates an event even if the value remains unchanged).

Please let me know if I'm overlooking something.

Could you also verify what's wrong with the link you provided ?

Regards.
Frans.
0 Kudos
Message 4 of 16
(4,728 Views)
Hello Frans,

I apologize for the broken link. I am looking into it. The example will be available here later today.

The example uses an event structure nested within a while loop. Once you see it, I think it may answer your questions.

Best Regards,

Matthew C
Applications Engineer
National Instruments
0 Kudos
Message 5 of 16
(4,728 Views)
Hello Frans,

The following link will now take you to the example:

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=C22A168F95CC3450E034080020E74861&p_node=%20DZ53012&p_source=External

Again, I hope this helps! If you have any further questions, let me know.

Matthew C
Applications Engineer
National Instruments
0 Kudos
Message 6 of 16
(4,728 Views)
Matthew,

the link works. Thanks !

I adapted my ActiveX client to programmatically change the value of "Slide 2" of the example Value_Changed_Events.vi ... and it doesn't work ... 8-(

The reason is that changing the value of "Slide 2" programmatically using setControlValue () in my Active X client does not generate an event (while changing it manually does).
As such programmatically I never arrive in the "Slide 2":Value Change portion of the event structure and as such no Value (Signaling) Property is set for "Slide 1" (which in its turn generates an event).
As a side note: if I was able to arrive in the "Slide 2":Value Change portion of the event structure, I didn't need the Value (Signaling) Property to change the value o
f "Slide 1" ... I could use the "Slide 1":Value Change directly.

Please let me know if I'm overlooking something.

Thanks for your support.
Frans.
0 Kudos
Message 7 of 16
(4,728 Views)
Matthew,

in fact the solution "could" be very simple: SetControlValue () is the ActiveX equivalent of the Value property, i.e. it allows to change the value of a control but does not generate an event ... What I need, is the ActiveX equivalent of the Value (Signaling) property, i.e. it allows to change the value of a control and also generates an event ... I'm afraid it does not yet exist.

Do you know if NI has plans to add such an ActiveX Server VI Class Method in the near future ?

Thanks.
Frans.
0 Kudos
Message 8 of 16
(4,728 Views)
Frans,

That is a good question, and I think your assertion is correct.

One possible workaround may be to always set the value of a boolean right after setting the value of a control. Use the boolean to change the state of a case structure to simulate a value change event. I edited the Value Changed Events.vi to illustrate this.

This method would require more coding, but I think it may have the same effect.

I hope this helps!

Matthew C
Applications Engineer
National Instruments
0 Kudos
Message 9 of 16
(4,728 Views)
Matthew,

thanks for your feedback.
Looking forward to the ActiveX equivalent of setting a Value (Signaling) Property. Would be great if NI decides to provide this "event-driven power" soon.

Regards.
Frans.
0 Kudos
Message 10 of 16
(4,728 Views)