LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Direct creation of a control reference?

The Subject might be a little off... wasn't sure what to call this.

 

Right-click on a block diagram, select Structures, and create an unassigned Local Variable.  Right-click on the Local Variable and up pops a menu where one of the options is "Select Item".  So, from the block diagram, a local variable to a control can be created.

 

I have a VI where a cluster contains references to nearly every object on the front panel.  This cluster is passed around everywhere in the entire program; it's how sub-VI's access the visible front panel.  This mechanism was in lieu of creating global variables.  And it was easy to make unwanted controls "disappear" during report generation.

 

Now I must create a bunch more front panel controls.  And references to them.

 

Example: There is a Ring control on the Front panel.  I'm working in one specific area of the Block diagram and would rather not start scrolling back and forth (and dragging the created reference) between the control icon and the area being wired up, said area requiring the reference.

 

Might someone pass a clue on how to create a reference to a control without having to right-click-on-the-control and select Create--> Reference ?

 

Thanks.

 

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

This will get a reference to all controls and indicators on the front panel of the VI. You can filter the array after this for the specific controls you are looking for if you want. 

 

Get All Controls.png

0 Kudos
Message 2 of 6
(3,161 Views)

If you have a lot of controls, you can highlight them all and create multiple references at the same time using the right-click method.  I think this functionality was available beginning in  2012.

 

There might be some sort of quick drop plugin available some where.  I have yet to delve into the world of scripting yet so I couldn't tell you if that is actually possible. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 6
(3,134 Views)

You can create references from the front panel as well as the block diagram.  So pick the multiple controls on the block diagram,  Right Click, Create Reference.  Then you are taken back to the block diagram right where you were working and drop them.

0 Kudos
Message 4 of 6
(3,124 Views)

You can create reference for any object (or copy existing), then right click and Link to required control

Or Application Control Palette -> VI server reference (linked to VI by default), and then Link to control

0 Kudos
Message 5 of 6
(3,114 Views)

Yeah yeah a month old.  Well I have a suggestion I hadn't seen yet.  With the Hidden Gems package you can get a reference to an object based on its label value.  TRef Find Object By Label.vi can return a reference to an object, of a specific class, on a block diagram, front panel, or other object, if the label is a specific value.  You can then use the To More Specific class to cast that reference to the class you know it should be.

0 Kudos
Message 6 of 6
(2,952 Views)