Author Topic: PLC ADDRESS VISIBLE  (Read 3045 times)

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
PLC ADDRESS VISIBLE
« on: March 29, 2022, 07:08:06 AM »
Can this code or something else be added to the Chart with Logging to hide the chart while still allowing it to function?
Code: [Select]
'*****************************************
    '* Property - Address in PLC to Link to
    '*****************************************
    Private InvertVisible As Boolean
    Private m_PLCAddressVisible As String = ""
    <Browsable(True), Category("PLC Properties"), Description("PLCAddress to control the LED visibility."), DefaultValue("")> _
    Public Property PLCAddressVisible() As String
        Get
            Return m_PLCAddressVisible
        End Get
        Set(ByVal value As String)
            If m_PLCAddressVisible <> value Then
                m_PLCAddressVisible = value

                '* When address is changed, re-subscribe to new address
                SubscribeToCommDriver()
            End If
        End Set
    End Property
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: PLC ADDRESS VISIBLE
« Reply #1 on: March 29, 2022, 08:54:04 AM »
The "Auto property" feature works with only one line of code needed

Public Property PLCAddressVisible() As String

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: PLC ADDRESS VISIBLE
« Reply #2 on: March 29, 2022, 08:02:04 PM »
Archie I have playing with this off and and on all day but this just isn't my bailiwick so I have not figured out where to put that code. Everything I tried produced errors I did not know what to do with.
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: PLC ADDRESS VISIBLE
« Reply #3 on: March 29, 2022, 08:27:56 PM »
I had an extra set of parentheses. The best place to put it is at line 170
Code: [Select]
    '*****************************************
    '* Property - Address in PLC to Link to
    '*****************************************
    Private m_PLCAddressValueItems As New System.Collections.ObjectModel.ObservableCollection(Of MfgControl.AdvancedHMI.Drivers.PLCAddressItemEx)
    <System.ComponentModel.BrowsableAttribute(True), System.ComponentModel.EditorAttribute(GetType(PLCAddressItemEditor), GetType(System.Drawing.Design.UITypeEditor))>
    <System.ComponentModel.Category("PLC Properties")>
    <System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)>
    Public ReadOnly Property PLCAddressValueItems() As System.Collections.ObjectModel.ObservableCollection(Of MfgControl.AdvancedHMI.Drivers.PLCAddressItemEx)
        Get
            Return m_PLCAddressValueItems
        End Get
    End Property

    Public Property PLCAddressVisible As String
#End Region

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
CORE VALUE OVERRIDING ?
« Reply #4 on: April 02, 2022, 04:42:07 PM »
Archie it placed the option in the properties but it is having no effect.  Is the "Embedded variable "VISIBLE  TRUE/FALSE" overriding the new code?

 
Code: [Select]
'*****************************************
    '* Property - Address in PLC to Link to
    '*****************************************
    Private m_PLCAddressValueItems As New System.Collections.ObjectModel.ObservableCollection(Of MfgControl.AdvancedHMI.Drivers.PLCAddressItemEx)
    <System.ComponentModel.BrowsableAttribute(True), System.ComponentModel.EditorAttribute(GetType(PLCAddressItemEditor), GetType(System.Drawing.Design.UITypeEditor))>
    <System.ComponentModel.Category("PLC Properties")>
    <System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)>
    Public ReadOnly Property PLCAddressValueItems() As System.Collections.ObjectModel.ObservableCollection(Of MfgControl.AdvancedHMI.Drivers.PLCAddressItemEx)
        Get
            Return m_PLCAddressValueItems
        End Get
    End Property
    Public Property PLCAddressVisible As String
#End Region
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: PLC ADDRESS VISIBLE
« Reply #5 on: April 02, 2022, 05:13:28 PM »
If you set Visible to False then run the application, does the chart no longer show?

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: PLC ADDRESS VISIBLE
« Reply #6 on: April 02, 2022, 09:09:08 PM »
Correct.. It does not and setting the bit to show it doesn't do anything.

I tried both ways.  TRUE and FALSE and set and reset the bit that is supposed to control the PLC Address visible but nothing happens. Whatever value I enter (TRUE / FALSE)  that is what I get. 


If you set Visible to False then run the application, does the chart no longer show?
« Last Edit: April 02, 2022, 09:19:29 PM by DavidSr »
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: PLC ADDRESS VISIBLE
« Reply #7 on: April 02, 2022, 09:38:49 PM »
In the ChartWithLogging.vb file, go to line 344 and set a breakpoint. This is the code at line 344:
Code: [Select]
          Try
              '* Write the value to the property that came from the end of the PLCAddress... property name
              Me.GetType().GetProperty(e.SubscriptionDetail.PropertyNameToSet).
                          SetValue(Me, Utilities.DynamicConverter(e.PLCComEventArgs.Values(0),
                                      Me.GetType().GetProperty(e.SubscriptionDetail.PropertyNameToSet).PropertyType), Nothing)

Run the application and if it stops at the breakpoint, hover over PropertyNameToSet and see what the value is.

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: PLC ADDRESS VISIBLE
« Reply #8 on: April 02, 2022, 10:18:46 PM »
Took me a wee bit to figure out how to do that... 
Property Value is set to  "As String".  See image in case I did not do something right.   
« Last Edit: April 02, 2022, 10:29:35 PM by DavidSr »
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: PLC ADDRESS VISIBLE
« Reply #9 on: April 03, 2022, 08:15:29 AM »
When you run the application, it should stop at that breakpoint. It will show a yellow arrow in the red dot. When it is stopped there, hover over PropertyNameToSet to see what the actual value is.

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: PLC ADDRESS VISIBLE
« Reply #10 on: April 03, 2022, 05:30:52 PM »
Archie I must be doing something wrong - it is not stopping = I only have the chart and a datasubscriber to test the popup screen and two buttons on the main form to test the the two things you gave ,me..  and the test popup screen in the application.

Breakpoint seems to be ignored.  In case it matters I am still running 399y BETA 33. Haven't seen anything in latest releases that concerned anything I do.I am using Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.1.3
I have pored over this and don't know what I could be missing, inserting a breakpoint seems pretty straight forward; I am running the app from the debugger so ???????????????????
Yes I feel stupid....   Never seen a program I couldn't break before.  That has to be a new one.

David

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
BREAK POINT NOT WORKING: OLD PROBLEM
« Reply #11 on: April 07, 2022, 08:10:56 AM »
Archie I found out that the BREAKPOINT not working is an old issue going back as far as 2015. I am surprised it is still an issue using VS 2022 and a new project.
I have followed all the steps to correct it but still no joy.  I will create a new project and start this all over again and see what happens.

I will let you know once I get the breakpoint to work.
David