Developer Center Resources

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a LabVIEW Palette

» Developing a VI-Based API » Creating a LabVIEW Palette

 

[Note: We recommend using VI Package Manager to create a LabVIEW palette.  A guide is available on the Developer Center here: VI Package Manager: Creating a Palette]

 

In this example, we will walk through the process of creating a LabVIEW palette from a set of VIs.

 

    1. Create a folder in LabVIEW\vi.lib named 'ATX' and a folder within it named 'Simple Math', where for this example 'ATX' is our fictional company name and 'Simple Math' is our product.  Further documentation about this folder naming convention is available in the File and Folder Names for Integrating into LabVIEW document.

      1.png
    2. Copy the contents of 'Palette Integration Example Files.zip' into LabVIEW\vi.lib\ATX\Simple Math\.

      2.png
    3. In order to integrate this API into the LabVIEW Palette there are two options:

      • Option 1: Category – This option will create a category for the API.  There are two options for naming this category, you can either use your Company Prefix (ATX in this example) and place your product(s) as subpalettes within this category or you can use your Company Prefix and Product name (ATX Simple Math in this example).
        • For this example, let's create a folder in LabVIEW\menus\Categories named 'ATX' and we will store our palette within this category. *Note: The folder will be set by default to 'Synchronize with Directory' in the  palette editor and you may want to remove this option in the  right-click menu.
          15.png
      • Option 2: Sub-palette – This option will create a sub-palette in one of the existing palette categories.  There are two options for naming this category, you can either use your Company Prefix (ATX in this example) and place your product(s) as subpalettes within this category or you can use your Company Prefix and Product name (ATX Simple Math in this example).

        • Create a folder in LabVIEW\menus\Categories\Mathematics named 'ATX Simple Math'
          2009-12-31_142755.png
    4. Launch LabVIEW
    5. From the 'Getting Started' window, select Tools > Advanced > Edit Palette Set...

    6. Using the palette editor, navigate to the palette location created in step 3 above.

      • Option 1 – There will be a main category entitled 'ATX'
        11.png

      • Option 2 – There will be a sub-palette in the 'Mathematics' category entitled 'ATX Simple Math'
        2009-12-31_142755.png

    7. Right-click the empty space within the sub-palette and select Insert > VI(s)...

    8. Navigate to the folder created in step 1, LabVIEW\vi.lib\ATX\Simple Math\. Select Add.vi and click 'Ok'.

      • Repeat this step in order to add 'Subtract.vi', 'Divide.vi', and 'Multiply.vi'.

      • Right-click each of the VIs you've added and select 'Edit Short Name' to remove the .vi extension from the name viewed in the palette.
        7.png
        Note: You can also choose to add the entire directory by selecting the 'Current Folder' option on the browse window rather than selecting individual VIs, but this will include all VIs in the folder and you may need to remove items afterwards.

    9. You can now manipulate the VIs in the sub-palette by dragging them into a particular order.

    10. Now let's create another sub-palette from within our sub-palette. Right click and select Insert > Subpalette.

    11. Choose 'Create a new palette file (.mnu)' and select OK.

      8.png
    12. Name the .mnu file 'Utilities.mnu' and save the file in the folder created in Step 3.

      • Option 1: LabVIEW\menus\Categories\ATX\

      • Option 2: LabVIEW\menus\Categories\Mathematics\ATX Simple Math\

    13. Enter the name for the sub-palette as 'Utilities'. Click OK.

    14. Move the sub-palette icon, if needed, to place it in it's own row (right-click the sub-palette icon and select 'Move Subpalette').
      9.png
      Note: To remove empty rows, columns, and spaces use the right-click menu options.

    15. Right-click on the empty palette space inside of the Utilities subpalette and select 'Insert > VI(s)...' and add the 'Combo.vi' function located in the folder created in step 1 (LabVIEW\vi.lib\ATX\Simple Math\).

      • Right-click the VIs you've added and select 'Edit Short Name' to remove the .vi extension from the name viewed in the palette.
        12.png

    16. Right-click the sub-palette icon and select 'Edit Subpalette Icon' to launch the LabVIEW Icon Editor for changing the palette icon.
      10.png

    17. Navigate up one level and edit the icon for the main palette entry.
      11.png

    18. Now let's save the palette .mnu files we've created. From the 'Edit Controls and Functions Palette Set' dialog window, choose 'Save Changes'.

13.png

  1. Review the files being modified and the folder they are to be placed in (...\Documents\LabVIEW Data\2009(32-bit)\Palettes\menus\Categories\Mathematics\...) as we will need to move them in the next step. Click 'Continue'.

  2. Navigate to the directory on disk where the .mnu files were saved to:

    • Option 1: ...\Documents\LabVIEW Data\2009(32-bit)\Palettes\menus\Categories\ATX\

    • Option 2: ...\Documents\LabVIEW Data\2009(32-bit)\Palettes\menus\Categories\Mathematics\ATX Simple Math
      Note: The mnu files were saved to the LabVIEW Data directory as this is where changes end-users make to the palette are stored. LabVIEW allows for multiple users on the same machine to have their own customized palette sets through use of this folder location, but this is not where an API should store menu files. API menu files need to be stored in the LabVIEW directory as described in the next step.

  3. Cut/Paste these files to the directory created in step 3:

    • Option 1: LabVIEW\menus\Categories\ATX\

    • Option 2: LabVIEW\menus\Categories\Mathematics\ATX Simple Math\
      Note: Be careful when editing palette files to not overwrite or change any of the existing .mnu files.

  4. Close LabVIEW completely. Launch LabVIEW again to view the addition we've made to the functions palette.

    14.png
Comments
Inertia
Member
Member
on

I found this does not work correctly if the VIs being referenced are not in vi.lib, e.g. if they are installed in your app's directory (which is my case).  When you move the mnu file from the My Documents location into the LabVIEW location, the link to the VI is lost.  Apparently the mnu file is not storing an absolute path to the VIs.  I'm working in LabVIEW 8.6.1 and have not figured out how to get this to work.

Jim_Kring
Trusted Enthusiast Trusted Enthusiast
Trusted Enthusiast
on

Inertia: Any time LabVIEW links to a file beneath a Symbolic Path it uses a path relative to the Symbolic Path (never absolute or relative to the calling file).

RDR
NI Employee (retired)
on

Hello Inertia,

I've tested this approach by doing the following:

  1. Put the example API files in the .zip above into 'Program Files\My Company\My Product\'
  2. Created a folder in menus\Categories\ for 'My Product'
  3. Added a subpalette in the LabVIEW palette editor
  4. Added the VIs in Program Files\My Company\My Product to the subpalette
  5. Saved changes & cut/paste the .mnu files from the LabVIEW Data folder into menus\Categories\My Product\

These steps appear to work for me, if you have any further trouble with this please send me an email (robert.des.rosier@ni.com) and I will help you sort it out.

Contributors