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 !
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:
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 your 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
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.
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 disadvantage 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.
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,
The following link will now take you to the example:
Again, I hope this helps! If you have any further questions, let me
know.
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 of "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.
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.
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.