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
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.
The KnowledgeBase contains another hotkeying method, with the article found here:
http://digital.ni.com/public.nsf/allkb/F28692BC75DF51EE862572C0000897D5

Instructions:
To implement this example:
  1. Run the VI
  2. Refer the label of the control to find out what they do to the front panel
  3. (Optional) Turn on the Highlight Execution to see the flow of the VI

To execute this example:

  1. Install the required software.
  2. Open the VI and refer the Implement Steps


Requirements
Software
LabVIEW 2012 or compatible

Hardware
-

bd.pngfp.PNG

**This document has been updated to meet the current required format for the NI Code Exchange.**

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