LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re-setting the Keyfocus after "Key Down" event?

I would like to make it easy for the user to enter a few users at a time.

The keydown event uses "ScanCode = 28" to determine when the "Enter key" was pressed. This action adds a new user name to a list box of users.

Any ideas on how I can set the keyfocus back to the string control, on which a "key down" Event was detected, so that the user automatically goes back to the string control to add the next user?

I hope this makes sense!
Marilie
0 Kudos
Message 1 of 13
(3,531 Views)
Hello Marilie,

just use a property node of that string control. Select the property "Key focus" and set it to true. That should do it.

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(3,531 Views)
Thanks for the advice. I omitted to say that I did try to set the key focus to True, inside the event loop, without success.
The event loop is inside a while loop.

Kind regards,
Marilie
0 Kudos
Message 3 of 13
(3,531 Views)
What happened when you used the property node? Here's a small example. I used the event Value Change for the string control but yours should work in a similar fashion. If you still can't get it to work, attach your VI that demonstrates the problem.
0 Kudos
Message 4 of 13
(3,531 Views)
Marilie Randewijk,

Attached below is an example I created that shows how to use the "Key Down?" filter event and change the control that the text is entered into. It works by swaping string controls when the enter key is pressed.

Hope this helps in your development.

Regards,

Matt F
0 Kudos
Message 5 of 13
(3,337 Views)
Hallo Matt,

Your example sounds very interesting, but unfortunately, I cannot open it, as I only have Labview 6.1.

Could you perhaps save your example in an earlier Labview context?

Kind regards,
Marilie
0 Kudos
Message 6 of 13
(3,337 Views)
It is very kind of you to supply an example, and I am interested to see how it works, but I use Labview 6.1 - which cannot read Labview 7 code.

I do not know which key has keyfocus after the event is finished....

I tried attaching the program, but get an error.

Regards,
Marilie
0 Kudos
Message 7 of 13
(3,531 Views)
What seems to work, is to assign the Return Key to the New User Control in Advanced/Key Navigation setup window.
0 Kudos
Message 8 of 13
(3,531 Views)
Here's the example in 6.1.
0 Kudos
Message 9 of 13
(3,531 Views)
Dennis, I still get an error (error 9) "Labview 7 is newer than Labview 6.1". Am I doing something wrong? I saved your example to my hard drive and tried opening it.
0 Kudos
Message 10 of 13
(3,531 Views)