AdvancedHMI Software
General Category => Support Questions => Topic started by: AabeckControls on July 08, 2015, 10:39:40 AM
-
Trying to replicate an old (crashed) PanelmatePC project & so far AdvancedHMI has been better, with more options.
However, this morning I came across an entry - a BasicLabel showing the Program Number. When it's clicked on to access the keypad to change the program number a keypad appears asking for a Passcode before the entry keypad appears.
Is there any way to add a Passcode to a keypad call, short of creating a new page to change the program number & adding a passcode to that FormChangeButton?
-
Here is a very quick solution (may not be the cleanest):
- In Solution Explorer, go to AdvancedHMIControls\Controls folder and look for BasicLabel.vb
- Copy that file and paste in the same Folder
- Rename the file to BasicLabelWithPasscode.vb
- Right click BasicLabelWithPasscode.vb and select View Code
- At the top of the file you will see "Public Class BasicLabel". Change that to "Public Class BasicLabelWithPasscode"
- Scroll down to line 651
- Insert the 8 lines shown here start with "'* Make a keypad popup asking for a passcode"
Protected Overrides Sub OnClick(e As System.EventArgs)
MyBase.OnClick(e)
'* Make a keypad popup asking for a passcode
Dim PassCodeKeypad As New MfgControl.AdvancedHMI.Controls.Keypad(m_KeypadWidth)
PassCodeKeypad.ShowDialog()
If PassCodeKeypad.ValidateChildren <> "1234" Then
MsgBox("Invalid pass code")
Exit Sub
End If
If m_PLCAddressKeypad IsNot Nothing AndAlso (String.Compare(m_PLCAddressKeypad, "") <> 0) And Enabled Then
- Build the project
- You should now have a BasicLabelWithPasscode in your ToolBox (it may be at the very bottom of the group)
-
Created the new BasicLabelWithPasscode & tried it, but when it pops up the 1st keypad there's no label like "Enter Passcode" (tried in the () after ShowDIalog but crashed).
And no matter what number is entered (1234, 123, 0, 7, 9876, etc.) it continues on to the entry keypad & lets the integer be changed in the PLC.
-
Try it like this:
Protected Overrides Sub OnClick(e As System.EventArgs)
MyBase.OnClick(e)
'* Make a keypad popup asking for a passcode
Dim PassCodeKeypad As New MfgControl.AdvancedHMI.Controls.Keypad(m_KeypadWidth)
PassCodeKeyPad.Text="Enter Pass Code"
PassCodeKeypad.ShowDialog()
If PassCodeKeypad.ValidateChildren <> "1234" Then
MsgBox("Invalid pass code")
Exit Sub
End If
If m_PLCAddressKeypad IsNot Nothing AndAlso (String.Compare(m_PLCAddressKeypad, "") <> 0) And Enabled Then
-
Hi Archie
Thanks for your excelent work.
I notice the last code not work, i tried the follow code and seems to work.
Dim PassCodeKeypad As New MfgControl.AdvancedHMI.Controls.Keypad(m_KeypadWidth)
PassCodeKeypad.Text = "Enter Pass Code"
PassCodeKeypad.ShowDialog()
If PassCodeKeypad.Value <> "1234" Then
MsgBox("Invalid pass code")
Exit Sub
End If
-
Vitor... You are correct. I did not notice that AutoComplete put "ValidateChildren" instead of "Value"