Example Code

Hotkeying and Key Navigation: Using Key Presses to Control the Front Panel

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Description

Overview
To Demonstrate How Hotkeying and Key Navigating using Key Presses to Control Front Panel

Description:
This example uses two methods of hotkeying: the Key Down event structure case and Key Navigation, and compares and contrasts the functionality of both.
Key Navigation is much easier to set up and use, requiring no wiring to do basic operations on controls, such as pressing a button. These options are accessed by right-clicking on your control, and mousing down to Advanced, then clicking Key Navigation. However, only certain keys may be used. Key Navigation may be masked by using property nodes, but this detracts from their ease of use.
Using an event structure, however, is more versatile, but has its own complications. For instance, you can use any key to perform any function, and you can mask events based on certain conditions (for instance, to mask the events when you are focused in a string control, so that you don't trigger anything while typing, which is done in this case). However, it does require an event structure and additional wiring, which may be difficult, especially if you have other event-driven elements in your program.

Instructions:
To implement this example:

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.