Example Code

Using the Toggle Key Binding Property Node for Boolean Controls Using LabVIEW

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

Overview

This example shows how to bind a "shortcut key" to a control

 

Description

This example shows how to bind a "shortcut key" to a control. By using the Toggle Key Binding control, you can change the shortcut key that controls "Light" to any of the possible values that are listed on the front panel with any combination of the Shift and Control key.

 

Requirements:

  • LabVIEW 2012( (or compatible)

Steps to Implement or Execute Code

  1. Run the vi.
  2. Change the Toggle key binding value, to toggle light.

 

NOTE:You can change the shortcut key that controls "Light" to any of the possible values with any combination of the Shift and Control key. 

 

**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.

Comments
NI-hilator
Member
Member
on

I like this approach. It is a little cleaner than using the Keydown event. However, this doesn't seem to work if the Light control is hidden.  I would have liked to use this technique to detect a Contol F# key combination to enable/disable another control but didn't want to have an LED control on the front panel confusing the operator. That said, yes, I know that I can hide the LED control under another front panel control.  I just thought people should know that caveat.

El_Penguino
Member
Member
on

Can you place the LED indicator off to the side so it is not in the viewable area?

NI-hilator
Member
Member
on

Yes, I this could be done.  You would then have to turn off screen resizing and turn off the scroll bars.  Would be easier to place the control in back of another control. Using the Key Down event was actually fairly trivial since I already had an event structure for other purposes.  This is what I ended up doing. I used a constant because there is nothing to hide on the front panel.

NI KeyComboEventCapture.png