LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i catch keyboard events from all panels and not only the active panel?

Hi

I need to catch keyboard events in a particular panel no matter which panel is active at the time of the key press.

More specifically, I have a pannel that launches numerous test routines, and a button that runs a set of test routines one after the other. Some of the tests in the set have their own panels. I need to know if at any stage "Esc" has been pressed because my program should stop running the whole set at that case. So I figured cathcing all keyboard events, even those that have been caused on other panels from the panel that needs to catch them, is what I'm after.

Can anyone help?

thanks in advance...
0 Kudos
Message 1 of 4
(3,072 Views)
This problem can be solved.

- Create a user event. For example 'New Keyboard' entry.
- Create a String Indicator and put a reference in every
VI.

If you have done that than let the frontmost VI create the
user event after you have updated the string. The string-
update is done by copying the keyboard entry to the string.

I think that must work.

With kind regards

Martin
With kind regards

Martin Kunze

KDI Digital Instrumentation.com
e-mail: martin.kunze@digital-instrumentation.com
Tel: +49 (0)441 9490852
0 Kudos
Message 2 of 4
(3,065 Views)
Hello,

Check this web page: http://www.lauwers.com.
There is a LabVIEW toolbox there that has a function called GetKeys.vi that I thik does what you need.

Hope this helps,
Paulo
0 Kudos
Message 3 of 4
(3,065 Views)
You don't need to catch all keyboard events to stop everything if an escape is pressed. There are several ways you can do this, but user events are probably the easiest. In your main VI, create a boolean user event which you will use to shut down everything. Pass this user event reference to every subVI which must exit on escape. In every VI which has a visible panel, put an event structure (you are doing this anyway to handle UI, right?). Register the shut down event and wire it to the event structure. You will have to pop-up on the event structure to show the user event terminals for wiring. Create an event case for the user event and fill in with your shut down code. In addition, in every VI with a UI, create an event case to capture keyboard events, filter for the ESC key, and fire the shut down user event if found. This sounds a lot more complex than it really is.

You can use queues and/or notifiers in much the same way, but since you already have the event structures in place to handle UI, you might as well use them.

Good luck. Let us know how you make out.
Message 4 of 4
(3,044 Views)