10-04-2010 12:37 PM
Is it possible to assign the Space Bar as a keyboard shortcut to toggle a boolean from one state to the next (that is after tabbing through the FP controls and setting the focus to that boolean)? More generally, is it possible to assign any key as a shortcut to a boolean (or a numeric for its increment/decrement actions)?
The Advanced>>Key Navigation... panel does not provide this option as far as I can see (LV 2009 SP1).
Thanks,
X.
Solved! Go to Solution.
10-04-2010 01:18 PM
You cannot assign an arbitrary key to that action. What you can do, instead, is to use an event structure to catch a key press event and respond accordingly. See attached example (LV 8.2).
10-04-2010 01:23 PM
Sure, I guess I could, but what's the problem with giving us this ability? The boolean is the control in focus, if the user press the "r" key, I may decide this means I need to reboot (or whatever).
10-04-2010 01:33 PM - edited 10-04-2010 01:33 PM
I never said there was a problem with giving users that ability. Where did you read that in my comment? I only told you that you can't do it in LabVIEW. If you want to see it considered as an addition to LabVIEW, then post the idea in the LabVIEW Idea Exchange, or see if this idea meets your request. There have actually been several "shortcut"-related ideas posted so you should search in that board to see what has already been proposed.
10-04-2010 01:48 PM
Sorry, I did not mean that as a response to your (helpful) suggestion. I was just wondering why this may be prevented by some LabVIEW (or other) constraint...
Thanks for the links.
X.
10-04-2010 01:48 PM
Sorry, I did not mean that as a response to your (helpful) suggestion. I was just wondering why this may be prevented by some LabVIEW (or other) constraint...
Thanks for the links.
X.
10-04-2010 02:10 PM
@xavier wrote:
Sure, I guess I could, but what's the problem with giving us this ability? The boolean is the control in focus, if the user press the "r" key, I may decide this means I need to reboot (or whatever).
Assigning arbitrary keys for key navigation is not a good idea. Key navigation does not care who has current focus, but shifts focus to the assigned control. Imagine there is a text control for a user name and whenever robert tries to enter his name, the system reboots. 😄
Using the event structure lets you query who has focus and respond accordingly. Much safer.
10-04-2010 02:30 PM
I am trying to understand that... F1, F2, Return, Escape, etc, are safe, but "a,b,c,...z" are not?
10-04-2010 02:40 PM
@xavier wrote:
I am trying to understand that... F1, F2, Return, Escape, etc, are safe, but "a,b,c,...z" are not?
a,b,c,...z are as valid keys to capture for commands as F1,F2, Return, etc. The problem is one of UI design. Having the 'r' key shutdown your program would be unexpected and frustrating for a user, but that behavior when you hit escape would not be as unexpected (though possibly still annoying :)). Be careful.
10-04-2010 02:48 PM
I want my user to be on their toes... what will happen if I press ... THAT KEY ?