Example Programs

cancel
Showing results for 
Search instead for 
Did you mean: 

Toggle Boolean Button with the Space Bar Using LabVIEW

Overview

This VI toggles the Boolean button when the space bar pressed, unless the user is entering text into the String Control

 

Description

This VI demonstrates how an event structure can be used to toggle the value of a Boolean button.The Toggle Key Binding property node can also be used to accomplish this, but the property node cannot be used with every key on the keyboard. In this example we want to toggle the Boolean button with the space bar, which cannot be used with the Toggle Key Binding property node.

Because we do not want the Boolean button to toggle when we are typing in the string control, the Key Focus property node is used to determine if the string control has key focus. If it does have focus, we do not toggle the Boolean control.

 

Requirements

LabVIEW 2012 or compatible

 

Steps to Implement or Execute Code

  1. Run the VI
  2. Press the space bar, and notice the Boolean button toggles
  3. Enter a string to the string control. Then press the spacebar, and notice that the boolean button isn't toggling

Additional Information or References

VI Block DiagramToggle Boolean Button with the Spacebar LV2012 NI Verified BD.jpg

 

 

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

 

 

Mark
NI App Software R&D