LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing data between XControl methods and facade?

Solved!
Go to solution

Good morning, everyone,

 

I have built an XControl that contains a Waveform Chart (and some other stuff), in LabVIEW 14.0, running on Windows.

 

I'd like to create a simple XControl method that clears the chart.  This "should be" easy, but the method VI block diagram doesn't have access to the controls and indicators on the facade.

 

This is my first major XControl, so I'm probably missing something simple.  But, what is it?

 

Thanks,

-- Mark

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

I have not done much with XControls but I believe your clearing action should be done in an event case within Facade.vi. Methods will run within the Facade, at least as far as I can tell, and you operate directly on the controls- not a reference. If you have a button to "clear the chart" within your XControl, set up an event within Facade.vi to respond to it and write an empty chart value to the Chart terminal.

 

By the way, if you haven't seen them, check out QControls. IMHO they're simpler to use than XControls, but you don't get the edit-time behaviors that XControls offer (which may or may not benefit you).

 

With a QControl you have a reference to the control, not the indicator/terminal itself, and you can call methods on that reference to do things like clear the chart or update something. I don't know if the toolkit is available in LV14 or not though.

0 Kudos
Message 2 of 4
(2,321 Views)

Thanks, Bert.  The requirement is that the chart has to be cleared in response to a method call on the X Control, not a button on the panel.

 

It looks like Q Controls were added after the LabVIEW version we are using (14).

 

-- Mark

0 Kudos
Message 3 of 4
(2,317 Views)
Solution
Accepted by topic author MarkBowles

In your State.ctl, place a reference of the type Chart.

In the Direction Change event of the Facade.vi, write the chart reference to the reference element in the State data (and be sure to set "State Changed" to True).

In your method VI, read the chart reference from the State data.

"If you weren't supposed to push it, it wouldn't be a button."
Message 4 of 4
(2,288 Views)