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.
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.
10-05-2012 06:55 AM - edited 10-05-2012 06:55 AM
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.
10-05-2012 07:01 AM - edited 10-05-2012 07:03 AM
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).
10-05-2012 07:23 AM
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?)
10-05-2012 07:51 AM
@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.
10-06-2012 11:38 AM
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.
10-06-2012 04:17 PM
@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.
10-08-2012 09:47 AM
Right click on the password control--> update value while typing