LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

keyboard-based event structure

Solved!
Go to solution

Is there a way to set specific keyboard(s) for an event? For example, I want to use 'ctrl+shift+A' as the event source. How could this be realized? Could anyone give me the specific procedures to do this?

 

Thanks very much!!!

0 Kudos
Message 1 of 8
(3,747 Views)
Solution
Accepted by topic author wzz525

Here is one way to do it...

ctrl+shft+A.png

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 2 of 8
(3,736 Views)

Thanks very much, Troy!

0 Kudos
Message 3 of 8
(3,732 Views)

Troy,

 

Why it cannot work when I write such a vi (as attached)? Can you revise it? Thanks!

0 Kudos
Message 4 of 8
(3,718 Views)

My mistake. The 'char' parameter in the event case outputs an I16. The string we're comparing it to is an 8bit character, they will never match. It would seem that you have to use a unicode character.

 

You need to define the character to match unicode 'Z' which is 0x005A.

 

You will also have problems using the stop button where you have placed it. See attached for working vi.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 5 of 8
(3,705 Views)

Thanks again. Help me a lot!

0 Kudos
Message 6 of 8
(3,703 Views)

Sorry, I got another question. For example, 'ctrl+shift+A' is a hotkey for another program run in my computer. If I change the 'Z' into 'A' in the vi, this vi didn't work correctly. That should mean the priority of the combination ('ctrl+shift+A') belongs to the other program. Do you have any idea to keep the hotkey for both the two programs (i.e., LabVIEW and a separate software)?

0 Kudos
Message 7 of 8
(3,697 Views)

The method I showed you will only work when the front panel has focus.

I believe there are different ways to capture keystrokes.

If another program has registered some keystroke combinations with OS, then you will not be able to capture them using the method I demonstrated.

 

For example: I have a dictionary app called WordWeb that pops up whenever I press ctrl+alt+w. I cannot capture the ctrl+alt+w key combination within labview whether my front panel has focus or not. The OS doesn't pass that key combination to LabVIEW, it uses it to trigger some other event.

 

I believe there is some way to do it using windows api calls but you are on your own there.

Do a search in the forum for "keyboard capture". There are a few similar questions to your in here.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 8 of 8
(3,689 Views)