LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

arbitrary keyboard shortcut to toggle a boolean (or increment/decrement a numeric)

Solved!
Go to solution

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.

0 Kudos
Message 1 of 11
(5,622 Views)
Solution
Accepted by topic author X.

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).

Message 2 of 11
(5,605 Views)

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).

0 Kudos
Message 3 of 11
(5,600 Views)

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.

0 Kudos
Message 4 of 11
(5,590 Views)

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.

0 Kudos
Message 5 of 11
(5,583 Views)

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.

0 Kudos
Message 6 of 11
(5,583 Views)

 


@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.

0 Kudos
Message 7 of 11
(5,567 Views)

I am trying to understand that... F1, F2, Return, Escape, etc, are safe, but "a,b,c,...z" are not?

0 Kudos
Message 8 of 11
(5,560 Views)

 


@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.

 

0 Kudos
Message 9 of 11
(5,556 Views)

I want my user to be on their toes... what will happen if I press ... THAT KEY ? Smiley Very Happy

Message 10 of 11
(5,547 Views)