AdvancedHMI Software

General Category => Support Questions => Topic started by: Phrog30 on April 21, 2017, 08:52:47 PM

Title: Stops Comms on Forms
Post by: Phrog30 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
Title: Re: Stops Comms on Forms
Post by: Phrog30 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.
Title: Re: Stops Comms on Forms
Post by: Archie 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.