Jump to content

[Discuss] Get Reference To All Controls


Recommended Posts

index.php?app=downloads&module=display&section=screenshot&id=28

Name: Get Reference To All Controls

Submitter: LAVA 1.0 Content

Submitted: 03 Jul 2009

Category: User Interface

LabVIEW Version: 8.2

Version: 1.2.0

License Type: BSD (Most common)

Potentially make this available on the VI Package Network?: Undecided

Copyright © 2007, GTech Automation

All rights reserved.

Author:

Dave A. Graybeal

--see readme text for contact information

Instructions:

This code has been tested to run under LabVIEW 8.2.1. Unzip the code into any folder of your choice and open the example called, GetRefExample.vi. This shows how to use the 'Get Reference To All Controls.vi' as well as the 'Get Control Reference by Name.vi' to obtain a reference to all controls and how to search thru those reference to obtain the reference you want.

Features:

Get Reference to All Controls.vi

-Gets the references and labels to All the controls on the front panel of the calling VI.

-Is Able to search thru all Tab Controls recursively to compile a complete list of Controls from the front panel.

Get Control Reference by Name.vi

-Polymorphic VI that allows for searching list for single reference or an array of references.

-Gets a Specific Reference from the List of All Controls by Control Name(Label).

Get Control References By Match Pattern.vi

-Gets an Array of References for all Controls containing the regular expression in the label.

Change Log:

1.0.0: Initial release of the code.

1.1.0: Changed the Class ID of a Tab Control from a constant to a Property Node (To support Future LabVIEW Releases)

1.2.0: Added Get Control References By Match Pattern.vi (Authored By: Justin Goeres) Thanks!

Modified GetRefExample to Include the Get Control References By Match Pattern.vi

Improved some performace by removing unnecessary Items from Loops (Thanks JFM!)

Removed all Dialog boxes from VI's and replaced them with proper error output messages.

Added shift registers where necessary to ensure proper error is passed out of each VI.

Recompiled under LabVIEW 8.2.1.

Click here to download this file

  • Like 1
Link to comment
  • 8 years later...

Not that there isn't valuable information to be pulled from this code, but in the last 8 years many things have changed in LabVIEW to make this process easier.  First there is native recursion, as well as indexing and conditional tunnels instead of nested loops.  But there is also the Traverse for GObjects on the palette under Application Control >> VI Scripting.  Getting references to controls based on the given label is done with a vi in the vi.lib TRef Find Objects By Label.vi in \vi.lib\Utility\traverseref.llb\TRef Find Object By Label.vi and is added to the palette with the Hidden Gems package.  Then there is my attempt at doing this with an XNode posted here.  You may want to look into using one of these functions from NI, or one written with modern techniques.  They have better performance, and probably more features.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.