LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Responding to Xcontrol State Changes

I would like to use an event handler in the VI containing an XControl to respond to a change to that XControl's state.  Is there an easy way to do this without continually polling the XControl's state using a property read and a Create/Generate Event approach?

 

Thank you!

Brian

0 Kudos
Message 1 of 4
(2,793 Views)

I would create a user event in the owning VI, sent it to the XControl with a custom property.

If you have an interesting state change you can sent the data via that user ref to the owning VI.

 

But my question is why?

State changes are ment for the XControl, and should be kept inside the XControl, the beauty of XControls is that everything is contained inside the XControl and is shielded from the owning VI.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 4
(2,791 Views)

Thanks Ton!

 

The answer to your question may be wrong-headed as this is my first attempt to use XControls.  I am trying to use a customized numeric slider (with multiple sliders) as a sort of thermostat.  One slider is the "TURN ON" point and the other is the current value.  One of the states that I have created in the XControl is a Boolean that is set to true when the current value slider exceeds the TURN ON slider.  In my main application, I would like to respond to that event.  The actual response to that event will necessarily be different for each instance of the XControl and thus I do not want to encapsulate the response into the behaviour of the XControl.

Does that make sense?

Note, I have set three other states which correspond to three other sliders - "TOO LOW", "TOO HIGH", and "TURN OFF" which I would also like to handle in similar ways.

Thank you again!

Brian

0 Kudos
Message 3 of 4
(2,787 Views)

Yes, that makes perfectly sense!

 

I think your question was stated wrong.

 

But the idea is still the same.

Add to you XControl's  state a User event Ref with a string datatype.

 

Create the user event in the owning application and register a event structure to this user event. 

With a custom property (set user event ref) you set the User event Ref in the Xcontrol's state.

 

If the alarm level is passed you generate a user event inside XControl and the owning VI will be triggered.

 

I you don't succeed please post an example as complete as can be.

 

Ton (I have done this several times)

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 4 of 4
(2,778 Views)