LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

xcontrol change properties of component controls

Hi All

 

The continuing saga of my range slider control.

 

I was able to build it into a xcontrol and it works great...  as long as I don't try to change the scale of the slider; which of course I have to do.  AND I have to have multiple copies of this control on the FP all with different scales.

 

Asking all the xcontrol experts out there...  how can I control properties of a component control of a xcontrol.  I have attached the files below.  It was pretty simple to get the basics working.

 

Thanks for any assistance.

 

Dan

 

 

0 Kudos
Message 1 of 6
(3,388 Views)

You will probably need to create a property node for your XControl.

 

Right-click on the XControl and select New > Property.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 2 of 6
(3,385 Views)

Thanks for the hint PackersFan (GO PACK GO!!), but I tried that and there is no access to the slider scale properties only the properties of the "Range Slider Data.ctl".  I could probably do it as a method, but that means that every time I start the VI I will have to set the scales.  I want this control to behave as much like a slider control as possible, but with the range capabilities.  The xcontrol really should inherit the properties and methods of any control being used in it.

 

Dan

 

0 Kudos
Message 3 of 6
(3,380 Views)

You should be able to use the reference to the XControl to get a reference to the slider.

 

Can't remember exactly how...

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 4 of 6
(3,373 Views)

@m3rl3n wrote:

The xcontrol really should inherit the properties and methods of any control being used in it.


That's something that probably every user of XControls thinks fairly soon after starting to use them (see this idea, for example), but there is a feasibility problem there in that you might have conflicting properties or you might now want to inherit from all the controls.

 

What you basically need to do is use the init event to get the reference of the control you want and add it to the state cluster of the XControl and then create property VIs as suggested which will act on that reference. Those VIs can then be called through the property node. If you want, there's a tool in the LAVA CR (by Ton, see the comments in the idea) which should automate this creation of property VIs.


___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(3,354 Views)

Here is an alternative (although a bit more complicated) method of setting the slider range.
With this method you can have multiple copies of your XControl on a front panel, each with a different default slider range, which you can set at edit time.

I have added an extra right-click menu item ("Set range") to the bottom of the slider right-click menu, which will only appear in edit mode. This pops up a VI where you can enter the slider max and min values.
Note that if you do change the max or min values, I set the "State changed" boolean to true. This tells LabVIEW that the state data of the XControl has changed, and that the VI containing the XControl has unsaved changes. When you save the containing VI, the state data of the XControls is saved along with the VI.
This state data can then be retrieved in the init.vi of the XControl so that you can set each copy of the XControl to have different default values.

To demonstrate that it works, I have added a VI called "Container.vi" to your project which has two copies of your XControl. Open up "Container.vi", right-click on either of the XControls and click "Set range" to set a different slider range. Then save and close "Container.vi".

When you reopen "Container.vi", the XControls should have retained any changes you just made to the slider ranges.

0 Kudos
Message 6 of 6
(3,333 Views)