Author Topic: PLC Control Form Change  (Read 1138 times)

AabeckControls

  • Full Member
  • ***
  • Posts: 193
    • View Profile
PLC Control Form Change
« on: August 15, 2019, 07:51:08 AM »
I have an existing application that has been running for a few years the customer would like a simple change on.

If the operator leaves the HMI on the "Motors' screen he would like it to automatically go to MainForm, which shows line and cycle status.

I have searched the forum and found posts about menu driven forms can be controlled by a PLC bit, but that would require a complete rewrite of this.

Is there any way, either with PLC bit or value, or a timeout in AHMI itself, that could change to MainForm?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: PLC Control Form Change
« Reply #1 on: August 15, 2019, 11:16:43 AM »
What about a DataSubscriber on the form to watch a bit in the PLC. When it goes true do a Me.Hide

You could also put a timer on the form and start it on the Visible event.
Code: [Select]
    Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.VisibleChanged
        '* Do not start comms on first show in case it was set to disable in design mode
        If NotFirstShow Then
            AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
        Else
            NotFirstShow = True
        End If

        If Me.Visible then Timer1.Enabled = True
    End Sub


   Private Sub Timer1_Tick_3(sender As Object, e As EventArgs) Handles Timer1.Tick
        Me.Hide()
    End Sub