LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Assign ENTER key to execute tabbing order jumps

How can I use the ENTER key to cycle key focus from one control to next. I have set the tabbing order and know that the key focus can be cycled with the TAB key.
 
However, I want to do the same cycling using the ENTER key.
 
Why? Because my application end users have been using the ENTER key to do this for ages, the GUI needs tons of data entry by the user, the ENTER key is always large in size and thus easy to hit when in a hurry.
 
Thanks!
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 1 of 12
(4,540 Views)

You could use an event structure to detect the "Key Down?" event. Then check the scancode in the event. If you get an enter (28), discard it and send a tab (15) to the scancode output of the event. Otherwise pass the scancode through without discarding it.

I'm not sure if I would do this because you could never actually use enter in the VI, it would always replace it with tab. You could have some logic if you need enter to work in any other way. This depends on the VI though.

Message 2 of 12
(4,534 Views)
You can also try key remapping software that will allow you to have the Enter key send the same code as the Tab key. Pros: no change to your code. Cons: you would need to be careful as to when this software is active, as you don't want it to mess up other applications.
Message 3 of 12
(4,530 Views)

MUCH more tedius:

You could have a property node for the "next control" and set it's "Key Focus" to true when vkey = "Enter", "Return" in a "Key Down" event from the current control. This gives you the ability to move the focus wherever, as well as simple error checking.

I use this method and also highlight the contents of the next control so that the user can use the exisiting value OR update it without manually deleting the exisiting entry.

0 Kudos
Message 4 of 12
(4,477 Views)
You could try a slight variation of the Key Down? filter event approach mentioned above.

Internally, LabVIEW doesn't use the scan code, so that's kind of a 'don't care' from the perspective of the internals. We *do* use the character and virtual key values. The trouble with scan codes is that they are OS and even hardware-specific, so your VI may not travel well.

Also, we distinguish <Return> from <Enter> on the numeric keypad, so you could still support multiline text entry by remapping <Enter>. 😄

In any case, if you get a virtual key of Return in a Key Down? filter event, replace the virtual key with ASCII and the character code with '9' and you're all set.

Hope this helps!

Message Edited by intvsteve on 05-22-2007 10:43 AM

intvsteve
LabVIEW R&D
Message 5 of 12
(4,513 Views)

Marc, Thanks!

I thought of this having looked at another thread on the forum. There are two issues with this approach:

1) The application has many sub-vis. Does that mean the keydown? event has to be programmed for each sub-vi?

2) Each sub-vi has many controls (lets say an average of 20). I understand the keydown? event will have to include each of these controls when I define the event. Right?

Sounds like a lot of work. But I am glad if this works fine.

Will try this out and update here

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 6 of 12
(4,481 Views)

smercurio_fc,

Thanks.

I understand the remapping software will be third party and I will need to execute before I start my application and then stop it after exiting my application. Or is the remapping code available in LV 7.1?

I could then simply insert its load module into the begining of my code and insert its exit module at the end of my code.

Any help?

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 7 of 12
(4,478 Views)
intvsteve, Thanks.
 
Glad that the return and enter key are treated differently. That does answer my worry about multiline entries.
 
I am not very sure I understood this "In any case, if you get a virtual key of Return in a Key Down? filter event, replace the virtual key with ASCII and the character code with '9' and you're all set."
 
Can you throw me a vi with the enter key programmed for tabbing? I will be using the return key (on numeric pad) for multiline text entries.
 
All, thanks for your inputs. Once I have zeroed onto a solution, I will update this post with results and comments.
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 8 of 12
(4,473 Views)

Someone correct me if I am wrong, but I don't believe that LabVIEW 7.1 (which I believe Gurdas is using) treats "Enter" and "Return" differently.

See attached for clarification of what was meant. The other case "ASCII" , default is just wired straight through.

0 Kudos
Message 9 of 12
(4,467 Views)
MattH posted exactly what you need. Also, to answer question 2 above, no, you do not need to include each control in the event. When you create the event, select <This VI> in the event sources box, and "Key Down?" in the events box. This will only filter the event of the VI in which it's contained, so yes, you will need to do this for any sub VIs that contain user input and need this binding to be remapped.
0 Kudos
Message 10 of 12
(4,460 Views)