Author Topic: Component event hooks  (Read 4933 times)

RedBinary

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • Red Binary
Component event hooks
« on: March 13, 2013, 09:57:57 AM »
I'd like to see the basic components have built in public event hooks. I'm currently using a timer to poll the state of a PLC tag that is also used in an indicator. I'm using a state change to drive a large read so that it doesn't poll continuously. Eventually (when I read up on VB coding events) I'll write events into it, but I think it'd be handy to have these "out of the box".

As an example of my current case: BasicIndicator1 could have events for option2On, option2Off, option3On, and option3Off.

RedBinary

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • Red Binary
Re: Component event hooks
« Reply #1 on: March 14, 2013, 01:08:50 PM »
Well I took about 10 minutes to both read up on event handling in VB as well as add "Event Option2ChangeState(ByVal state As String)" & "RaiseEvent Option2ChangeState(Values(0))" to BasicIndicator.vb so I suppose I jumped the gun making this a feature request!

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Component event hooks
« Reply #2 on: March 14, 2013, 02:45:26 PM »
A trick that is used often is to add a BasicLabel and an event handler for TextChanged. In the event handler, you can read a large chunk of data. That keeps communications way down by only monitoring the one value.

kaiyara

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Component event hooks
« Reply #3 on: June 24, 2013, 01:24:44 AM »
If you are communicating with more than one PLC, you will need to add a driver instance to the form for each PLC and give each one the IP address of the corresponding PLC. Then in the visual control, set the CommComponent property to which driver instance to use.
Kaiyara