From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pressing Enter to confirm text in sub-vi popup. (Password Prompt)

Hi,

 

I have made a sub-vi popup window to prompt a user for a password. 

I would like this window to behave like you would expect a password dialog to behave i.e. begin typing without having to select the string control, and press enter once to confirm the text.

 

 

 

At the moment I have to press enter twice once to confirm the string control, and a second time to activate the OK button.

I have been playing around with 'Key Focus' but have had no luck so far.

 

This seems like something that should be easily achievable, but so far my google/forum searching hasn't come up with anything.

 

See attached VIs.

 

Thanks.

Download All
0 Kudos
Message 1 of 7
(4,241 Views)

As long as the key focus is on a control the Enter key will go to that control. The button assigned to the Enter key will not react on it in that case.

You can create a Key Down event for the VI and implement the functionality you want (check if the user clicked Enter, and if so, do the same thing you do when the user clicks OK, or you could programmatically click the OK button (Value Signaling property)).

 

(I could not look at your VI since currently I don't have LV2012).

 

0 Kudos
Message 2 of 7
(4,236 Views)

Thanks for the reply.

 

LV2009 version attached.

 

I have had a go at using the 'Key Down?' event, but that picks up the typing of the password too.

(will persevere with this, unless anyone has another idea?)

0 Kudos
Message 3 of 7
(4,225 Views)

@Phil_ wrote:

I have had a go at using the 'Key Down?' event, but that picks up the typing of the password too.

(will persevere with this, unless anyone has another idea?)


Sure, but you don't need to do anything on any key except Enter. If you wanted you could also use Esc to cancel the dialog.

 

Message 4 of 7
(4,217 Views)

Right click the OK button and select Properties. Go into the key navigation tab. Find the TOGGLE action and set that to Enter. This basically means that pressing Enter will toggle the OK button, which is what you want. Make sure to cancel the focus binding. You can use the same process to bind Esc to the cancel button.


___________________
Try to take over the world!
Message 5 of 7
(4,201 Views)

@tst wrote:

Right click the OK button and select Properties. Go into the key navigation tab. Find the TOGGLE action and set that to Enter. This basically means that pressing Enter will toggle the OK button, which is what you want. Make sure to cancel the focus binding. You can use the same process to bind Esc to the cancel button.


I assumed he already did that, but when the password control has key focus the first Enter will only confirm the string entry and remove key focus. The second Enter will then toggle the OK button.

 

 

0 Kudos
Message 6 of 7
(4,185 Views)

Right click on the password control--> update value while typing

0 Kudos
Message 7 of 7
(4,144 Views)