I did this on a project I did last year. Edit BevelButtonDisplay.vb , scroll down to the line just before End Class, then add the code:
#Region "Keypad popup for data entry"
'*****************************************
'* Property - Address in PLC to Write Data To
'*****************************************
Private m_PLCAddressKeypad As String = ""
<System.ComponentModel.Category("PLC Properties")> _
Public Property PLCAddressKeypad() As String
Get
Return m_PLCAddressKeypad
End Get
Set(ByVal value As String)
If m_PLCAddressKeypad <> value Then
m_PLCAddressKeypad = value
End If
End Set
End Property
Private WithEvents KeypadPopUp As MfgControl.AdvancedHMI.Controls.IKeyboard
Private Sub KeypadPopUp_ButtonClick(ByVal sender As Object, ByVal e As MfgControl.AdvancedHMI.Controls.KeyPadEventArgs) Handles KeypadPopUp.ButtonClick
If e.Key = "Quit" Then
KeypadPopUp.Visible = False
ElseIf e.Key = "Enter" Then
If m_CommComponent Is Nothing Then
DisplayError("CommComponent Property not set")
Else
If KeypadPopUp.Value IsNot Nothing AndAlso (String.Compare(KeypadPopUp.Value, "") <> 0) Then
'* 29-JAN-13 - Validate value if a Min/Max was specified
Try
If m_KeypadMaxValue <> m_KeypadMinValue Then
If KeypadPopUp.Value < m_KeypadMinValue Or KeypadPopUp.Value > m_KeypadMaxValue Then
System.Windows.Forms.MessageBox.Show("Value must be >" & m_KeypadMinValue & " and <" & m_KeypadMaxValue)
Exit Sub
End If
End If
Catch ex As Exception
System.Windows.Forms.MessageBox.Show("Failed to validate value. " & ex.Message)
Exit Sub
End Try
Try
'* 29-JAN-13 - reduced code and checked for divide by 0
If KeypadScaleFactor = 1 Or KeypadScaleFactor = 0 Then
m_CommComponent.Write(m_PLCAddressKeypad, KeypadPopUp.Value)
Else
m_CommComponent.Write(m_PLCAddressKeypad, CDbl(KeypadPopUp.Value) / m_KeypadScaleFactor)
End If
Catch ex As Exception
System.Windows.Forms.MessageBox.Show("Failed to write value - " & ex.Message)
End Try
End If
KeypadPopUp.Visible = False
End If
End If
End Sub
'***********************************************************
'* If labeled is clicked, pop up a keypad for data entry
'***********************************************************
Protected Overrides Sub OnClick(e As System.EventArgs)
MyBase.OnClick(e)
If m_PLCAddressKeypad IsNot Nothing AndAlso (String.Compare(m_PLCAddressKeypad, "") <> 0) And Enabled Then
If KeypadPopUp Is Nothing Then
If m_KeypadAlphaNumeric Then
KeypadPopUp = New MfgControl.AdvancedHMI.Controls.AlphaKeyboard(m_KeypadWidth)
Else
KeypadPopUp = New MfgControl.AdvancedHMI.Controls.Keypad(m_KeypadWidth)
End If
KeypadPopUp.StartPosition = Windows.Forms.FormStartPosition.CenterScreen
KeypadPopUp.TopMost = True
End If
'***************************
'*Set the font and forecolor
'****************************
If m_KeypadFont IsNot Nothing Then KeypadPopUp.Font = m_KeypadFont
KeypadPopUp.ForeColor = m_KeypadForeColor
KeypadPopUp.Text = m_KeypadText
If m_KeypadShowCurrentValue Then
Try
KeypadPopUp.Value = m_CommComponent.Read(m_PLCAddressKeypad, 1)(0)
Catch ex As Exception
MsgBox("Failed to read current value of " & m_PLCAddressKeypad)
End Try
Else
KeypadPopUp.Value = ""
End If
KeypadPopUp.Visible = True
End If
End Sub
#End Region