First, I'll say that I really like this approach to HMI development. Factory Talk View is so cumbersome and .Net is so much more powerful that it makes sense.
I must be missing something obvious, but I can't find any event to handle for the controls such as DataChanged. Can you point me in the right direction? I see the communication control has DataReceived, but I don't think that is the expected approach.
I just need a way to react when the value changes. Thanks, Ed
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your response. I'm using (in my examples) a BasicIndicator, would the TextChanged event be the right one? Maybe it is just the wording that is confusing to me, since there is no text. Also, what about the DigitalPanelMeter - TextChanged also?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately those two controls have not data changed event. One work around is to add a BasicLabel with the same address, use the TextChanged event, and set the visible property to false.
If you know a little VB.NET, you can modify those controls to add the event you want.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, I'll suggest that as a future improvement. Since each control has a value property, why not add a ValueChanged event.
Another question then, I thought maybe I could use the EthernetIPforCLXComm1.DataReceived event something like this:
Private Sub EthernetIPforCLXComm1_DataReceived(ByVal sender As Object, ByVal e As Drivers.PLCCommEventArgs) Handles EthernetIPforCLXComm1.DataReceived
Dim str As String = e.Values.Clone()
End Sub
and then parse out the values from the string, but this event never seems to fire - is it supposed to fire when data is received from the PLC? If not, then what is the purpose of this event?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The DataReceived event does not fire when the components receive data because they use subscriptions for data. It's purpose it to indicate when data comes back from an asynchronous read.
Private Sub EthernetIPforCLXComm1_DataReceived(ByVal sender As Object, ByVal e As Drivers.PLCCommEventArgs) Handles EthernetIPforCLXComm1.DataReceived
Label1.Text = e.Values(0)
End Sub
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First, I'll say that I really like this approach to HMI development. Factory Talk View is so cumbersome and .Net is so much more powerful that it makes sense.
I must be missing something obvious, but I can't find any event to handle for the controls such as DataChanged. Can you point me in the right direction? I see the communication control has DataReceived, but I don't think that is the expected approach.
I just need a way to react when the value changes. Thanks, Ed
Each component may have a unique event. For example, a BasicLabel has an event of TextChanged that can be used to detect data change.
Thanks for your response. I'm using (in my examples) a BasicIndicator, would the TextChanged event be the right one? Maybe it is just the wording that is confusing to me, since there is no text. Also, what about the DigitalPanelMeter - TextChanged also?
Unfortunately those two controls have not data changed event. One work around is to add a BasicLabel with the same address, use the TextChanged event, and set the visible property to false.
If you know a little VB.NET, you can modify those controls to add the event you want.
OK, I'll suggest that as a future improvement. Since each control has a value property, why not add a ValueChanged event.
Another question then, I thought maybe I could use the EthernetIPforCLXComm1.DataReceived event something like this:
Private Sub EthernetIPforCLXComm1_DataReceived(ByVal sender As Object, ByVal e As Drivers.PLCCommEventArgs) Handles EthernetIPforCLXComm1.DataReceived
Dim str As String = e.Values.Clone()
End Sub
and then parse out the values from the string, but this event never seems to fire - is it supposed to fire when data is received from the PLC? If not, then what is the purpose of this event?
The DataReceived event does not fire when the components receive data because they use subscriptions for data. It's purpose it to indicate when data comes back from an asynchronous read.
EthernetIPforCLXComm1.AsyncMode=True
EthernetIPforCLXComm1.ReadAny("MyTag")
Private Sub EthernetIPforCLXComm1_DataReceived(ByVal sender As Object, ByVal e As Drivers.PLCCommEventArgs) Handles EthernetIPforCLXComm1.DataReceived
Label1.Text = e.Values(0)
End Sub