LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pressing ENTER-key once instead of twice

Solved!
Go to solution

Hi!

 

I'm trying to develope a Login-system. I want the user to choose a username (from a list) and then enter a password (in a textbox with 'password display' activated). After the password is entered i want the user to be able to press Enter as an option of clicking the Login-button.

 

I'm trying to do this with an Event Structure reading the Key Down-event and using the VKey-node to register what key is pressed. (see picture below)

My problem is that the user has to press the Enter-key twice for anything to happend. I want it to happend on the first click.

 

Anyone has any hints?

0 Kudos
Message 1 of 4
(2,636 Views)
Solution
Accepted by topic author ByDesign

Hey PeterPoPS,

 

If you right click on the Enter button and go to Properties > Key Navigation, you can select the toggle property to bind to the Return key from there. You may want to implement the correct mechanical action so that the button doesn't stay fixed in this state, such as Latch until Released. You can change the type of mechanical action the button responds with by right clicking on the enter button control and navigating to the Mechanical Action menu. If you later wish to use this button within an event structure, you have to be careful as the latching mechanical action must be explicitly read and reset through the event.

 

This way you could base an event around the enter button value change.

 

Hope this helps!

 

Regards,


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 2 of 4
(2,632 Views)

Right click on the sting control and select 'Update Value while typing'. I believe this will do what you want to do.

0 Kudos
Message 3 of 4
(2,621 Views)

@PeterPoPS wrote:

Hi!

 

I'm trying to develope a Login-system. I want the user to choose a username (from a list) and then enter a password (in a textbox with 'password display' activated). After the password is entered i want the user to be able to press Enter as an option of clicking the Login-button.

 

I'm trying to do this with an Event Structure reading the Key Down-event and using the VKey-node to register what key is pressed. (see picture below)

My problem is that the user has to press the Enter-key twice for anything to happend. I want it to happend on the first click.

 

Anyone has any hints?


Hello again,

 

I've tried to produce a similar VI to you, except in my example a press of the enter key results in an increment of a value. I didn't have to press the Enter key twice in order to get the expected operation, however the difference is I looked for the press of the key globally. In your event structure, the key down event it is focussed on the with respect to the btnLogin, which could be the reason as to why you're getting an odd response.

 

KeyEvent.png

 

I suggest that you try to implement the event through <This VI> > Key > Key Down, and hopefully this will work for you. But, maybe I'm not understanding your problem correctly, do you need the event to be with respect to the button?

 

Regards,


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 4 of 4
(2,608 Views)