top of page

Accueil > Blog > Article

Creating elegant interfaces? Everything is in the context!

To create modern and elegant interfaces, everything is in context, well, we must to say "everything is in the context menu!" Yes, LabVIEW allows the creation of shorcut menus which can be very useful. These menus allow any self-respecting HMI to quickly add functionality without polluting the application with a thousand buttons. You will surely have noticed that a right click on an object of a front panel, during execution, brings up pre-built context menus. Imagine that you can easily create custom context menus from scratch! You can also dynamically modify ALL menus to show or remove certain features.

Too many menus kill the experience!

If all these menus bother you (and so this article by association), you can very well disable them for a particular object. The Disable option is located in the Advanced > Run-Time Shortcut Menu category. To disable them all, you just have to uncheck the Window appearance > Customize > Allow default run-time shortcut menu option. Obviously even if these menu right clicks are practical, we must avoid having them absolutely everywhere! We must also avoid placing major software functionalities there.

Creation of a custom menu

Création du menu contextuel personnalisé

You can create your personalized menu simply by right clicking on your front panel object. The Advanced > Run-Time Shortcut Menu category allows you to do this. The Shortcut Menu Editor will then open. It will allow you to create your personalized menu. We encourage you to play around with this editor to see the possibilities. For example, you can place separators and group options into subcategories! Remember that you will be able to manage your menu dynamically in your code even if it is personalized.


In the editor, you will find two very important fields: Item Name is the name you will see displayed in the menu. Item Tag is the one that will appear in your code.

Éditeur de menu contextuel
Shortcut menu editor

Use and manage your menus

Menu Programming > Dialog & User Interface > Menu

You can efficiently and dynamically manage all your shortcut menus thanks to the dedicated palette present at the base of LabVIEW. The palette is located in Programming> Dialog & User Interface> Menu. How does it manage dynamically? Dynamically this means that while your code is running, you can add options or remove them from your menu! Both default menus and custom menus are dynamically manageable. It's all well and good, but you can't just use this palette anyhow! See below how I use it (and therefore how to use it!).

We advise you to use a producer-consumer model with an event, it is a very classic model. The model LabVIEW gives you when you start a VI is a good start.


See below a simple architecture for managing your menus with the example of a button:

  1. Dynamically change options: Use the Shortcut Menu Activation? event associated with the control for which you want to modify its menu. For example you may want to add options if at this precise moment certain conditions are met. You can then use the Insert/Delete Menu Items VIs to insert or remove options there before it is shown to the user. You can still gray out certain options or assign them a keyboard shortcut using Set Menu Item Info.

  2. Transmit the selected option: Uses the Shortcut Menu Selection (User) event to retrieve the associated Item Tag and transmit it for processing. If you have options in your menu already offered by LabVIEW, you don't even need to manage it - it's automated.

  3. Do the option: Depending on the Item Tag you received, take the action you want!

Example of structure for managing context menus
Example of a structure for managing shortcut menus


bottom of page