Author Topic: BasicLabel ValueChanged event problem  (Read 2740 times)

Morgan

  • Newbie
  • *
  • Posts: 44
    • View Profile
BasicLabel ValueChanged event problem
« on: May 10, 2016, 10:55:25 AM »
The ValueChanged event is triggering constantly event though the BasicLabel value has not changed.  The PollRate seems to have no effect.
The TextChanged event is working properly and only triggers when the value has changed.

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: BasicLabel ValueChanged event problem
« Reply #1 on: May 10, 2016, 11:33:02 AM »
I think you need to specify which driver you are on.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: BasicLabel ValueChanged event problem
« Reply #2 on: May 10, 2016, 03:30:20 PM »
I tried this using version 3.99e and a Modbus driver. This is the code I used:
Code: [Select]
    Private Sub BasicLabel1_ValueChanged(sender As Object, e As EventArgs) Handles BasicLabel1.ValueChanged
        MsgBox("Event Fired - " & Now)
    End Sub

I was only getting 1 message box per change of value.


Morgan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: BasicLabel ValueChanged event problem
« Reply #3 on: May 12, 2016, 08:43:49 AM »
I am using the EthernetIPforCLXCom driver.  See screen shot
« Last Edit: May 12, 2016, 08:58:04 AM by Morgan »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: BasicLabel ValueChanged event problem
« Reply #4 on: May 12, 2016, 08:53:35 AM »
What version of AdvancedHMI are you using?

Morgan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: BasicLabel ValueChanged event problem
« Reply #5 on: May 12, 2016, 08:59:15 AM »
V399e
I have the poll rate set to 6000
The PLC is a CompactLogix and it is in the program mode, just to make sure the value would not change.
« Last Edit: May 12, 2016, 09:12:16 AM by Morgan »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: BasicLabel ValueChanged event problem
« Reply #6 on: May 12, 2016, 09:11:49 AM »
Can you post your code of your event handler and I will setup the same to try to replicate.

Morgan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: BasicLabel ValueChanged event problem
« Reply #7 on: May 12, 2016, 09:19:43 AM »
Attached is the Form
The basic label is linked to a bit address in the PLC
The BooleanDisplay is set to On/Off
The ValuePrefix is the tag name

Morgan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: BasicLabel ValueChanged event problem
« Reply #8 on: May 12, 2016, 09:26:01 AM »
Here is an example with a bit address that is off

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: BasicLabel ValueChanged event problem
« Reply #9 on: May 13, 2016, 09:19:06 AM »
I don't have access to CompactLogix PLC so I tried this with EthernetIPforSLCMicroCom1 driver.

The only way I can replicate constant event firing is if I change MyBase.Text to m_Value inside the BasicLabel.vb / UpdateText() sub in the following If statement:

Code: [Select]
            '* True/False comes from driver, change if BooleanDisplay is different 31-DEC-11
            If (m_Value = "True" Or m_Value = "False") And m_BooleanDisplay <> BooleanDisplayOption.TrueFalse Then
                If m_Value = "True" Then
                    If m_BooleanDisplay = BooleanDisplayOption.OnOff Then m_Value = "On" 'MyBase.Text replaced with m_Value
                    If m_BooleanDisplay = BooleanDisplayOption.YesNo Then m_Value = "Yes" 'MyBase.Text replaced with m_Value
                Else
                    If m_BooleanDisplay = BooleanDisplayOption.OnOff Then m_Value = "Off" 'MyBase.Text replaced with m_Value
                    If m_BooleanDisplay = BooleanDisplayOption.YesNo Then m_Value = "No" 'MyBase.Text replaced with m_Value
                End If
                '* 24-APR-16 Ver 3.99e
                Return
            End If

This is normal for this changed code since m_Value is changed back to True/False the next time driver polls the PLC.

With unchanged code I get normal behavior.

Morgan, if you set BooleanDisplay back to TrueFalse do you still get the same event firing?
« Last Edit: May 13, 2016, 10:06:41 AM by Godra »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: BasicLabel ValueChanged event problem
« Reply #10 on: May 13, 2016, 10:17:06 AM »
I've been unable to replicate this either. I posted the application I created for the test. You can download the EventFireTest solution from here:

https://sourceforge.net/projects/advancedhmi/files/advancedhmi/3.5/SampleProjects

Be sure to build the solution before opening any form in design view. Change the IPAddress of the CLX driver and run this test app, then let us know your results.

Morgan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: BasicLabel ValueChanged event problem
« Reply #11 on: May 16, 2016, 01:16:19 PM »
Sorry, this was my fault.

I began the project with version V399d.  There was a problem with the control in that it always returned True/False regardless of the BooleanDisplay property.  I solved the problem by changing the MyBase.text to m_Value in the "If m_Value = "True" Then ... Else ... End If".  I had also added some other choices.  When the v399e came I replaced the control with the one I modified.

Morgan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: BasicLabel ValueChanged event problem
« Reply #12 on: May 16, 2016, 04:49:07 PM »
The problem with the 399e version is that the Prefix and Suffix properties do not work.  The "Return" statement that was add ('* 24-APR-16 Ver 3.99e) bypasses the prefix and suffix.
« Last Edit: May 16, 2016, 05:06:47 PM by Morgan »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: BasicLabel ValueChanged event problem
« Reply #13 on: May 16, 2016, 05:02:35 PM »
This problem recently discovered and a fix was made that will appear in version 3.99f