01-17-2013 05:16 PM
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!!!
Solved! Go to Solution.
01-17-2013 05:39 PM
Here is one way to do it...
01-17-2013 05:40 PM
Thanks very much, Troy!
01-17-2013 07:54 PM
Troy,
Why it cannot work when I write such a vi (as attached)? Can you revise it? Thanks!
01-17-2013 09:13 PM
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.
01-17-2013 09:27 PM
Thanks again. Help me a lot!
01-17-2013 09:44 PM
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)?
01-17-2013 10:27 PM
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.