LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keyboard Capture

How do I monitor the keyboard for a key press?  I would like to use the Esc key to abort a process.  I have no problem monitoring a daq input but I do not know how to monitor the keyboard.

 

Thanks for any support.
Paul

0 Kudos
Message 1 of 5
(4,886 Views)

You can use an Event Structure and monitor the VI for the "Key Down" event, and check to see if it is the Esc key.  Read the LabVIEW Help for more information about Event Structures.

-D

0 Kudos
Message 2 of 5
(4,878 Views)
You can assign a key, in you case the Esc key, to a control. Then respond the value change event for this control.
0 Kudos
Message 3 of 5
(4,870 Views)

Hi Paul,

The suggestions above are all great suggestions. In fact, from an efficiency standpoint, they're optimal. If you only have the Base version of LabVIEW, however, you won't be able to use Event Structures.

In that case, there are some VIs in the Input Device Control functions palette called Initialize Keyboard and Acquire Data that you can use to continuously poll the keyboard for a specific key stroke such as Escape. I've attached a screenshot with an example.

Message Edited by Jarrod S. on 02-16-2006 12:11 PM

Jarrod S.
National Instruments
Message 4 of 5
(4,867 Views)

Thank you all very much. 

The last suggestion with the keyboard control solved my problem.  I was trying to use the event option per the attached file with no success.

Thanks again,

Paul

0 Kudos
Message 5 of 5
(4,840 Views)