Hello Guest it is April 26, 2024, 01:17:29 PM

Author Topic: Password protect a button?  (Read 5256 times)

0 Members and 1 Guest are viewing this topic.

Password protect a button?
« on: January 21, 2010, 07:56:22 AM »
I'm using a button to toggle screens using ToggleScreens().  I'd like to password protect the button so operators can't get to the set up screens.  I've got the password working fine using the Inputbox Function and TextBox Statement (done it both ways, works either way).  My problem is getting the input box to display password characters (i.e. " * ") instead of the actual typed characters.  Does anybody know how to do this, or if it is even possible?

Thanks for the help.

TOM
Re: Password protect a button?
« Reply #1 on: March 02, 2010, 03:44:14 PM »
If you are using a text box, you just need to set the password character in properties.  Can be done from the properties box, or done via code.

Reference: http://msdn.microsoft.com/en-us/library/aa983584%28VS.71%29.aspx

You could also have "hidden" buttons to open the password box.  Make the button the same color as your background with no border.  I've done that on UI for those users that seem to try every button, just because it's there.

JW
Re: Password protect a button?
« Reply #2 on: March 02, 2010, 05:18:43 PM »
For regular VB it is that simple.  But in Mach the option for a password box is not available, I talked to Brian about it.  It could be done playing some shell games, but didn't sound worth it and a little over my abilities, right now.  I am currently using a hidden button, and getting by.  Just thought it'd be cool to have a password box.  Oh well...maybe a possible addition in the future?  ;)
Re: Password protect a button?
« Reply #3 on: March 02, 2010, 05:24:35 PM »
OK, I haven't gotten into all of that yet.  Done VB programming for years, and just starting to get setup to do a Mach conversion.

JW
Re: Password protect a button?
« Reply #4 on: April 18, 2010, 08:03:18 AM »
Hi Tom,
     Don't know if this will work for you or not.  What I use is a login screen as screen 1 with a userdro for a pin (personal id #) and a button with if then statements for each pin (pin can be operator chosen but you have to edit the button script for each new pin) or assigned (allows for a number of pins to be pre entered to the button).  When I enter my pin I access a setup/test screen that isn't accessible from the other screens.  The pin is in plaintext, but is zeroed out in the script for the button.  I also disable the menu line and have buttons to enable it and re-disable it on the setup/test screen. Here is a sample of my button script.
getuserdro (1000)
If getuserdro (1000) = 1111 Then doOEMbutton (5)  
If getuserdro (1000) = 1112 Then doOEMbutton (2)
If getuserdro (1000) = 1113 Then doOEMbutton (2)
setuserdro (1000, 0)
I also use a login button on each screen to return to screen screen 1 (login screen) so that when I make changes I just press login and voila ready for the next operator.  This could also work to load a different toggle button based on pin input.
I suppose one could use a login screen with a dro (pin) and button that loaded different screen set files, one for operators and one for setup (haven't tried this yet, too easy for me the other way).  Hope you find this useful.
Re: Password protect a button?
« Reply #5 on: April 19, 2010, 01:16:07 PM »
Hmmm....interesting approach.  I like the idea, but I don't think it'd work any better than what we've got going now.  I'm using an input box for password input, then if the password is correct navigate to the set up screens.  This uses a hidden button and to the untrained operator it's like the other screens don't even exist.

Thank you for the input.

TOM
Re: Password protect a button?
« Reply #6 on: April 25, 2010, 12:13:39 PM »
Tom,
The password character "*" was bothering me.  So I spent a few hours working this out.  I hope it's what you were looking for.  Please let me know.

Sub main
Begin Dialog joe 60,60,140,185,"Enter Password"
OKButton 10,50,40,12
CancelButton 10,70,40,12
Text 10,10,120,12, "Password is Not Case Sensitive",.Pin1
TextBox 10,30,40,12,.Pin,32
End Dialog
Dim Dlg1 As joe
Button = Dialog (Dlg1)
If Button = 0 Then Exit Sub
If Dlg1.Pin = "Tom" Then DoOEMButton (5)
If Dlg1.Pin = "Chuck" Then DoOEMButton (1)
End Sub

Chuck
Re: Password protect a button?
« Reply #7 on: April 25, 2010, 08:56:09 PM »
That is exactly what I was looking for.  Nice work!!!