Author Topic: TabControl As HMI  (Read 1933 times)

darko_jd

  • Newbie
  • *
  • Posts: 2
    • View Profile
TabControl As HMI
« on: July 24, 2017, 07:58:39 PM »
Please,

I use SerialDF1forSLCMicroCom1 for micrologix, and I made 8 screens on a tabcontrol with 8 tabs, but communication is slow. How can I turn on the advancedHMIControls of the active tab and turn off controls for inactive tabs?

and thanks for help me


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: TabControl As HMI
« Reply #1 on: July 24, 2017, 09:07:28 PM »
AdvancedHMI has been designed to work optimally using multiple forms with a driver instance on each form. As a form is hidden, the driver is set to DisableSubscriptions which effectively pauses updating for the hidden form.

When using TabControl, you have only one form with a single driver, therefore all controls are updated even when hidden. To work around this, you must create a driver for every tab you have and set the ComComponent property for the associated tab's controls to it's driver instance. Then using code, you need to set DisableSubscriptions to True when the tab is hidden, then back to False when it becomes visible again.

Something like this:
Code: [Select]
Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged
      If TabControl1.SelectedIndex = 0 Then
          Tab1Driver.DisableSubscriptions = False
          Tab2Driver.DisableSubscriptions = True
      ElseIf TabControl1.SelectedIndex = 1 Then
          Tab1Driver.DisableSubscriptions = True
          Tab2Driver.DisableSubscriptions = False
      End If
  End Sub