From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Developer Center Resources

cancel
Showing results for 
Search instead for 
Did you mean: 

Integrating into the LabVIEW Menus

» Creating a Development Tool » Integrating into the LabVIEW Menus

 

Example:Get VI Information from a Menu Item

 

Menu integration is needed for many LabVIEW tools. Menu items give the end-user quick and easy access to an add-on's functionality.  This document will illustrate how to place items into the menus and how to customize their appearance.

 

Menu Locations

Custom menu items may be placed in the LabVIEW File, Tools, and Help menus. Custom menu items can be created by placing folders and VIs in select LabVIEW sub-folders. The following table lists menu and corresponding folder location for custom menus, where labview is the installation directory of LabVIEW, for example C:\Program Files\National Instruments\LabVIEW 2009.

Menu

Folder Location

File

labview\wizard

Tools

labview\project

Help

labview\help

 

Note: Custom menu items in the wizard directory will be displayed  in the "File" menu for VIs, but not for projects.

Menu Layout

LabVIEW creates menus at launch based on the contents of these three folders. VIs in these folders will appear as a menu item, and will open when selected. Top-Level VIs in LLBs are treated the same as VIs. Sub-folders will appear as sub-menu items.

 

VIs will open when selected from the menu, but will not automatically run. If a VI should run when selected, set the VI to “Run when opened” in the Execution page of VI Properties.

 

The following image is an example of a custom menu item, “Custom Menu” created in LabVIEW. Notice that “Custom Menu” contains two items and one sub-menu. The folder structure is also shown.  Notice that this folder is located in labview\project and contains two VIs and one sub-folder. The VIs are displayed in the menu as items, and the sub-folder is displayed as a sub-menu.

1 Custom Menu.png 1 Folder.png

 

Excluding Items

All VIs, LLBs, and folders with filenames beginning with an underscore ("_") will not be included in the menu. Also, folders that do not contain a VI or LLB anywhere in their hierarchy will not be included, as they would have no sub-items.

Item Naming

The VI Window Title (File » VI Properties » Window Appearance » Window title) is the used for the item name. By default, this is the name of the VI, with the “.vi” extension removed. In the above example, A. First VI.vi is listed in the menu as “A. First VI...”. You may also customize the menu item name by changing the Window title. All VI names in the menu are terminated with an ellipsis (“...”), indicating to the end-user that an action will take place.

 

Folders are given the same name in the menus as on disk. In the above example, the folder “Custom Menu” contains a sub-folder “B. Sub Menu”; these are listed in the Tools menu by their folder names.

Custom Layouts

Menu items, both folders and VIs, are listed alphabetically by default. This layout can be customized with a ASCII text (.txt) file. By creating a text file in a sub-folder, you can change the order of the items and insert separators.

Guidelines

  • The text file must have the same name as its containing folder.

  • Folders and VIs should be listed by filename in the desired order in the text file.

  • Separators can be denoted by a dash (“-”).

  • Each entry - whether a VI, folder, or separator – must occupy its own line in the text file.

In the above examples, a text file Custom Menu.txt could be placed in the “Custom Menu” folder to modify the layout. Below is an example of possible Custom Menu.txt contents.

B. Sub Menu
-
C. Last VI.vi
A. First VI.vi

This text file would modify the menu item order and insert a separator, as seen below.

2 Custom Menu with Text File - Smaller.png

Any items that are not listed in the text file will be added after the text file's contents. In the example above, if the text file had not listed “A. First VI.vi”, the menu would look identical, as “A. First VI” would be listed after the other three lines.

 

VI Information

It many situations, it is useful for a menu item to obtain information about the VI that was open when the menu was selected.  The example Get VI Information from a Menu Item illustrates this process.

Chris Bolin
LabVIEW Partner Program, CLA
Comments
soupy
Member
Member
on

so i'm placing something in the file menu....and it's appearing 3d in the list between "New..." and "Open..". Is there any way to specify where it gets inserted at the top level??

RDR
NI Employee (retired)
on

You can create a custom layout to re-order the top level by creating a wizart.txt in the \wizard\ folder.  For an example, the Viewpoint TSVN toolkit on the Tools Network makes use of a wizard.txt file to modify the order of items in the File menu.  This is also something to keep in mind - other libraries may also require a wizard.txt and therefore I recommend taking the following action in a custom action VI:

  1. Check to see if wizard.txt exists
    • If not, create and save wizard.txt
  2. Append the order of your VIs to wizard.txt

Add line separators as described in the doc above by inserting a dash ("-").

James@Work
Member
Member
on

I'm looking for documentation on adding items to the right-click menus within a project.

Specifically, the My Computer and Target menus: 

 

ProjectMenus.png

 

Are there any references I have overlooked for "how-To" do this?

EDIT

And, also to the Project's File menu, since it doesn't include the items added to the VI's File menu.

/EDIT 

Thanks for any suggestions or references.

 

James

Tech Advisor - Automation
LabVIEW 5.0 - 2020
Matt-J
NI Employee (retired)
on
Hi James, Sounds like you may want to look into using the Project Provider Framework to add items into right-click menus. See below for some additional detail: http://forums.ni.com/t5/Developer-Center-Resources/Customize-the-LabVIEW-Project-Explorer-Using-the-... Note, this method is not officially supported by NI.
Matt J - NI Tools Network
raphschru
Active Participant
Active Participant
on

Hi to whoever may read this !

 

Is there any mean to bind custom keyboard shortcuts to open/launch VIs added to the Tools menu ?

 

Thanks.