LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any event associated with pressing ENTER button on keyboard

I have made an application in Labview which offers a Login window at the start. User enters username and password, and click <OK> button to proceed. The mouse up event for OK button let the application proceed further. I want that when user presses <enter> after entering password in its string control, the application should proceed further in the same manner as it proceeds in the case of mouse up event for <ok> button.
Is there any type of event whcih fires when <enter> button (on keyboard)  is pressed when the focus is over some control.
0 Kudos
Message 1 of 11
(8,211 Views)

You can use the key down events.  The outputs from the event give you the information as to what key was pressed.  You can then just run the same code that you run in the other event.

If you are trying to differentiate between return and enter you will need LabVIEW 8.0.

0 Kudos
Message 2 of 11
(8,210 Views)
Thanks Evan,
 
Nice tip, but the ASCII code in the a 16 bit integer form generated by KEYDOWN event is zero when <enter> key is pressed. It is zero as well when Function keys (F1, F2,..), Shift, Ctrl or ESC keys are pressed. How can come to know that <enter> key is pressed not other ones.
0 Kudos
Message 3 of 11
(8,201 Views)
Use the Vkey terminal. It returns all those keys.
 
Another option would be to watch for the value change.  Its not perfect but when the user hits enter it will fire the value changed of  the string.  However, if they types in the control and then clicked out it would also fire.
Message 4 of 11
(8,195 Views)
Thanks alot Evan, Vkey really works.l
0 Kudos
Message 5 of 11
(8,192 Views)
Why so complicated?
 
Set the string control for the password to "limit to single line" and then simply wait for a value change event on the password field. 😄
Voila!

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 6 of 11
(8,184 Views)

The only down side to the value change is that you may get more events than you want.  For example I like to use tab and shift-tab to move around things.  So if I was entering my password and realized I had made a mistake in my user name I may hit shift-tab to go back to the user name.  In this case we get the value change, and depending on his code we hit ok and my login fails.  As the user I was not ready to hit enter or ok yet.

Small use case but it may depend on your users or how the whole thing comes together.

Message 7 of 11
(8,172 Views)
Thanks again Evan, your one is more logical solution. I was going for value change solution but didn't realize the other exceptions like pressing shift-tab etc.
0 Kudos
Message 8 of 11
(8,163 Views)
Am I the only one seeing the most? obvious. Assign the <enter> key with the boolean button.

This will cost you no extra code...

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 9 of 11
(8,154 Views)

"TonP" <x@no.email> wrote in message news:1147412408118-364222@exchange.ni.com...
Am I the only one seeing the most? obvious. Assign the &lt;enter&gt; key with the boolean button. This will cost you no extra code...Ton


This is definitely much more readable, easier, smaller, and faster to make.


But it is so old fashioned! Nowadays, everybody wants to use events...


Regards,


Wiebe.


0 Kudos
Message 10 of 11
(8,129 Views)