03-05-2015 06:51 PM
Hi all, I am a self-taught LabVIEW user. I hope somebody here can help me solve this problem which is driving me nuts.
I'm trying to make a small password prompt. Only by entering the correct password a certain function is executed at runtime. My code was working smoothly until I realized that pressing the "Return" key in the password prompt added a new line; as a result the user is forced to use the OK button. I wanted to catch the Return key to make it work like a "standard" password prompt.
This is what is driving me nuts: my code works perfectly if I single-step it. If I run the code (CTRL+R) when I press "Return" the password is not accepted. A probe tells me that the password is always blank in that case. If I use the OK button everything works.
I implemented my password subVI with a small state machine, so that both the OK button and the Return key are directing to the same state. In the same way I also catch the Escape key, to work as the Cancel button, and that works smoothly. I also use the Discard function to drop the Return key so that my string does not get an extra unwanted new-line. I cannot possibly think of any race condition that can make my code working only when going through it slowly, step-by-step.
I am completely at a loss, and I hope somebody can help me! Thanks!
PS: I only attached the VI because due to the state-machine nature I would have had to post a bunch of screenshots. I can do that tomorrow if you need me to.
Solved! Go to Solution.
03-05-2015 06:57 PM
03-06-2015 08:53 AM
It works! Thank you!
That is one of those "LabVIEW things" that I will never understand...
03-06-2015 09:36 AM
Better yet.
Select "Limit to Single Line" instead
Use the Value Change event for Password (The value will change when Enter is pressed)
Add a Password Mouse Leave event to remove focus
Add a Key Up event to catch "Esc" (ScanCode = 0x01)
Basically- try this mod:
03-06-2015 09:42 AM
Lots of good suggestions too. Thanks!