Author Topic: Click event using Basic Button Advance HMI  (Read 2799 times)

lgrimm

  • Newbie
  • *
  • Posts: 22
    • View Profile
Click event using Basic Button Advance HMI
« on: June 22, 2016, 03:49:37 PM »
I am trying to Perform Click using VB.Net code to Click Basic Button (Advanced HMI) .

'Set up another button to Click Button BT!, which is windows button and it works fine.

Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.BT1.PerformClick()
    End Sub
When I try it on AdvancedHMI button it does not work.
btbStop is PLC stop button.

I want to use the Click to change bits in PLC. Thus if I can activated Button in code, I can make it work.

Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.btbStop.PerformClick()
    End Sub

Any Ideas.

Thanks

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: Click event using Basic Button Advance HMI
« Reply #1 on: June 22, 2016, 04:45:00 PM »
This will not work because the BasicButton does not perform its PLC writing during a Click event, instead it uses the MouseDown and MouseUpEvent.

Is your objective to write to the PLC within another part of your code?

lgrimm

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Click event using Basic Button Advance HMI
« Reply #2 on: June 22, 2016, 05:52:48 PM »
Yes:
My objective is to write to PLC  depending on the certain parameters in my program. Mostly just a bit.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: Click event using Basic Button Advance HMI
« Reply #3 on: June 22, 2016, 06:02:16 PM »
You will need to write the values using the driver instance directly. For instance, if you are using the ModbusTCP driver:

ModbusTCPCom1.Write("40001","1")

lgrimm

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Click event using Basic Button Advance HMI
« Reply #4 on: June 22, 2016, 06:44:17 PM »
Great:

Thank You