Author Topic: tooltip  (Read 3886 times)

Darrell

  • Full Member
  • ***
  • Posts: 198
  • Electrician / PLC Technician
    • View Profile
tooltip
« on: July 08, 2019, 10:17:19 PM »
I was asked this today , so its got me wondering , Is there a way to make a live plc address value show up in the tool tip

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: tooltip
« Reply #1 on: July 08, 2019, 10:34:33 PM »
I tried this out using a DataSubscriber  and it actually worked:
Code: [Select]
    Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        ToolTip1.SetToolTip(BasicLabel2, e.Values(0))
    End Sub

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: tooltip
« Reply #2 on: July 08, 2019, 11:19:38 PM »
Here is a couple more general examples of how to set a tooltip using a control's MouseHover event:

Code: [Select]
    Private ttip As New ToolTip
    Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'Show ToolTip window even if the parent control is not active
        ttip.ShowAlways = True
        ttip.SetToolTip(SquareIlluminatedButton2, "Hello")
    End Sub

#Region "ToolTips"

    Private Sub SquareIlluminatedButton1_MouseHover(sender As Object, e As EventArgs) Handles SquareIlluminatedButton1.MouseHover
        'Show the control's PLCAddressValue
        ttip.SetToolTip(SquareIlluminatedButton1, SquareIlluminatedButton1.PLCAddressValue.ToString)
    End Sub

    Private Sub BasicLabel1_MouseHover(sender As Object, e As EventArgs) Handles BasicLabel1.MouseHover
        'Show the driver's IP Address
        ttip.SetToolTip(BasicLabel1, "IP Address: " & ModbusTCPCom1.IPAddress.ToString)
    End Sub

#End Region

ToolTip shows a text description so any string could be shown.

ToolTip will, by default, be using the MouseHover event so tooltips could be set anywhere else (just like Archie's example shows or the MainForm_Load sub in the code above).
« Last Edit: July 08, 2019, 11:29:36 PM by Godra »