Author Topic: Stops Comms on Forms  (Read 827 times)

Phrog30

  • Guest
Stops Comms on Forms
« on: April 21, 2017, 08:52:47 PM »
If I have a form with more than one com component, is there a way to stop one on hidden, but not the other?

James

Phrog30

  • Guest
Re: Stops Comms on Forms
« Reply #1 on: April 21, 2017, 09:34:04 PM »
I tried:
Code: [Select]
AdvancedHMIDrivers.Utilities.StopComsOnHidden(PLC_1, Me)but this didn't work.

I ended up with this:
Code: [Select]
PLC_1.DisableSubscriptions = Not Me.Visible
'PLC_2.DisableSubscriptions = Not Me.Visible  'Don't disable this one
this worked ok.  If there is a better way please let me know.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Stops Comms on Forms
« Reply #2 on: April 22, 2017, 08:26:46 AM »
Your solution is what I was about to recommend. The default code snippet is generic code that looks for all drivers and disables their subscriptions. By replacing that code with the code you have, it makes it more specific to the drivers in your application. If you add more driver instances, you will just have to remember to add them to the code if you want them to stop on hidden.