LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

password protection on a control

Hello, I have a control on my front panel that I would like password protected.
What I want, is if someone clicks on the control, a pop-up box appears prompting them for a password. if they enter the correct password it allows them to change the value of the control, then after the VI runs 1 time the password would have to be entered again to edit the control value. If they enter the wrong password, a message should be displayed saying "sorry incorrect password".

Is this possible? Does anyone have an example of this?

Thanks in advance,
Ryan
Ryan

LV 7.1
0 Kudos
Message 1 of 16
(4,584 Views)
Ryan

set the enabled state of your control to disabled... then you can use an event structure to capture the Mouse Down? (the one with the red arrow)event for your control then fire your pwd VI from within that case, if the correct password is entered re-enable the control allow the edit then disable the control again...
note: this will not fire an event if the control is tab to....

Dan
0 Kudos
Message 2 of 16
(4,584 Views)
Dan, how/where can I find the Mouse Down? thing?
Ryan

LV 7.1
0 Kudos
Message 3 of 16
(4,584 Views)
Ryan

well i am assuming you are using LV6.1 or higher i guess...

anyhow:

Structures --> Event Structure --> right click event structure , add event case, click on your control name and find the event... let me know what LV version you are using and i'll send you something

Dan
0 Kudos
Message 4 of 16
(4,584 Views)
Dan, I am using Labview 7.0
Ok I did what you said and found the mouse down? function. I have never used an event structure before so bear with me, I will play around with it and try to get something together. If you could post/email me an example that would be great.

Thanks again
Ryan

LV 7.1
0 Kudos
Message 5 of 16
(4,584 Views)
Ryan

this example may get you started...
0 Kudos
Message 6 of 16
(4,584 Views)
Dan, I have a slight glitch. When I click on the control it fires the event case, which is correct. On the mouse click I have it enabling a string control thing that I am using as an input field for the password. This works fine, as it enables it. The problem is the cursor is a little hand and will not allow me to click in the string box to enter the password.

Any suggestions?
Ryan

LV 7.1
0 Kudos
Message 7 of 16
(4,584 Views)
Ryan

can you send me the vi(s) your working with ??

dan.bookwalter@hst.stoneridge.com

Dan
0 Kudos
Message 8 of 16
(4,584 Views)
Be careful with the mouse down? event and the dialog message box. You can get really strange behavior if you postion the front panel so that the message box appears over the numeric control. What happens is that you mouse down, this fires the even, the dialog box appears, you mouse up (but this message is never sent to the control), you click ok, and the numeric control continues to increment. This behavior is outlined in the online help (open LabVIEW >> help >> VI, Funtion and How-to help) under Caveats and Recommendations when Using Events in LabVIEW .
0 Kudos
Message 9 of 16
(4,584 Views)
Well the mouse down? event is not working very well for me. The events fire properly but my cursor is always a little hand icon, and will not allow me to press anything on the front panel, this includes my control.

For now I just changed the event structure to a toggle switch and labeled it "Unlock for editing".
This way they flip the switch, prompted for PW, if correct they get 10 seconds to edit the control value, then it locks the control and continues on.

I would still rather have the mouse down? event work so if anyone has any ideas please post them.
Ryan

LV 7.1
0 Kudos
Message 10 of 16
(4,584 Views)