Author Topic: BasicLabel Keypad Show Value  (Read 1562 times)

Morgan

  • Newbie
  • *
  • Posts: 44
    • View Profile
BasicLabel Keypad Show Value
« on: August 24, 2016, 12:22:03 PM »
I am using the BasicLabel to allow the operator to change timer values.  The scale factor is set to .001 in order to display the timer value in seconds.  If I set the property "KeypadShowCurrentValue" to true, the value that is read from the PLC and displayed on the keypad is not scaled.

For example: If the timer is set for 10 seconds the value displayed on the keypad will be 10000.  Changing it to 10 and saving the result works correctly; the value saved back to the PLC is 10000.

I am currently looking at version 3.99n but I checked an older version (3.99d) and it does the same thing.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: BasicLabel Keypad Show Value
« Reply #1 on: August 24, 2016, 12:47:58 PM »
- In Solution Explorer expand down the AdvancedHMIContols project
- Under that expand down the \Controls folder
- Right BasicLabel.vb and select View Code
- Go to line 848
- Modify the code as follows:
Code: [Select]
        If m_KeypadShowCurrentValue Then
            Try
                Dim CurrentValue As String = m_ComComponent.Read(m_PLCAddressKeypad, 1)(0)
                '* v3.99p - added scaling
                If m_ValueScaleFactor = 1 Then
                    KeypadPopUp.Value = CurrentValue
                Else
                    Try
                        Dim ScaledValue As Double = CDbl(CurrentValue) * m_ValueScaleFactor
                        KeypadPopUp.Value = ScaledValue
                    Catch ex As Exception
                        System.Windows.Forms.MessageBox.Show("Failed to Scale current value of " & CurrentValue)
                    End Try
                End If

            Catch ex As Exception
                System.Windows.Forms.MessageBox.Show("Failed to read current value of " & m_PLCAddressKeypad)
            End Try
        Else
            KeypadPopUp.Value = ""
        End If
« Last Edit: August 24, 2016, 08:54:29 PM by Archie »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: BasicLabel Keypad Show Value
« Reply #2 on: August 24, 2016, 08:54:42 PM »
Made a correction to the above code.