AdvancedHMI Software

General Category => Support Questions => Topic started by: Morgan on May 10, 2016, 10:55:25 AM

Title: BasicLabel ValueChanged event problem
Post by: Morgan 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.
Title: Re: BasicLabel ValueChanged event problem
Post by: Noe on May 10, 2016, 11:33:02 AM
I think you need to specify which driver you are on.
Title: Re: BasicLabel ValueChanged event problem
Post by: Archie 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.

Title: Re: BasicLabel ValueChanged event problem
Post by: Morgan on May 12, 2016, 08:43:49 AM
I am using the EthernetIPforCLXCom driver.  See screen shot
Title: Re: BasicLabel ValueChanged event problem
Post by: Archie on May 12, 2016, 08:53:35 AM
What version of AdvancedHMI are you using?
Title: Re: BasicLabel ValueChanged event problem
Post by: Morgan 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.
Title: Re: BasicLabel ValueChanged event problem
Post by: Archie 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.
Title: Re: BasicLabel ValueChanged event problem
Post by: Morgan 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
Title: Re: BasicLabel ValueChanged event problem
Post by: Morgan on May 12, 2016, 09:26:01 AM
Here is an example with a bit address that is off
Title: Re: BasicLabel ValueChanged event problem
Post by: Godra 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?
Title: Re: BasicLabel ValueChanged event problem
Post by: Archie 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.
Title: Re: BasicLabel ValueChanged event problem
Post by: Morgan 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.
Title: Re: BasicLabel ValueChanged event problem
Post by: Morgan 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.
Title: Re: BasicLabel ValueChanged event problem
Post by: Archie on May 16, 2016, 05:02:35 PM
This problem recently discovered and a fix was made that will appear in version 3.99f