Example Code

Password Input VI with Key Navigation

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

 

Overview: This VI has a password input UI that will allow you to compare the input to a known input value.


Description:

It is event based so it will trigger off of the enter button on the front panel or either of the two standard Enter keys on the Keyboard. You can set the password from a front panel control that is disabled during run time. You can also set the it by using this dialog as a sub VI. By default the password is password.


Requirements: LabVIEW 2012 (or compatible). Hardware: none.


Steps to Implement or Execute Code:

1. Set the string control to use Password Display and Limit to Single Line in the right click menu.

Password Display for String.PNG

2. Set the Event Structure to trigger an event when the value of the Enter Button is changed.

Password Event Structure.PNG

 

3. On the Key Navigation tab we wll select Return in the Toggle dropdown. NOTE be sure to check the "Set to focus on Toggle" If you do not the enter event will trigger but because the cursor will still be in the password box the value will not update.

Password Key Navigation.PNG

 

This Vi keeps track of the number of incorrect password tries, you can make modifications to exit if it exceed a certain value. You can also modify this VI to run as a Sub VI. Just add the password correct button to the loop exit condition so the window will close if you get the password correct.

 

Additional Information or References: 

 

Password Input VI with Key Navigation FP.png

 

Password Input VI with Key Navigation BD.png


 **This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Snowman 6008
NI Employee (retired)
on

Great Example, very useful!!

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
aap
Member
Member
on

Brilliant example. I used it for screen password protection in my HMI. I did tweak it so that the text entry field has focus when opened and when an incorrect password is entered. That way you don't have to use the mouse, just hit <Enter>.

Thanks for this!!!

Obatalasf
Member
Member
on
¿Me podría dar un ejemplo, cómo hacer que un subVI