Tips and Tricks for Creating Shortcut Menu Plug-Ins
The following list provides additional information about creating and using shortcut menu plug-ins.
When you select and right-click multiple front panel or block diagram objects, plug-ins retrieve refnums for all the selected objects. Refnums pass to the Affected Items array of plug-ins when they match the Affected Items array. Refnums for all other objects pass to the Remaining Items array of plug-ins. This functionality allows you to enable plug-ins when multiple selected objects must match Affected Items or to enable plug-ins when only some selected objects match Affected Items.
When you right-click without a selection list, you may still get multiple refnums. For example, right-clicking a terminal generates refnums for the terminal, its node, and the diagram of the node. As with the multiple selection case, you can determine how each plug-in decides to apply its menu items in these cases.
Many plug-ins perform similar functionality. You may find subVIs useful to your plug-ins by browsing the plug-ins that LabVIEW provides. These plug-ins are in the labview\resource\plugins\PopupMenus directories.
To share subVIs among multiple plug-ins, you can store the subVIs in a subdirectory that is in the same folder as your LLB.
To add a menu separator bar to the shortcut menu, leave the Menu Item Display Name as an empty string in the build VI.
To reload plug-ins without restarting LabVIEW, create an empty VI, add the Invoke Node to the block diagram, configure the Invoke Node for the Menus:Refresh method, and run the VI. This method is also useful if you write an installer for your plug-ins. You can run the method as part of the installation process. If you use the JKI VI Package Manager (VIPM) software to distribute your plug-ins, add the Menus:Refresh method to the post-installation VI.