xwang

How to show descriptor in tooltip of ProcessBook

Discussion created by xwang Employee on Apr 10, 2013
Latest reply on Mar 9, 2015 by dng

Some of users are willing to displaying the tag's descriptor when the mouse over the value or the curves of trends.   This thread will provide a function to show the "descriptor" automatically when add some new components in the .pdi file.

 

Solution
1.    Open the Display in ProcessBook
2.    Open the Visual Basic Editor (Tools --> Macro --> Visual Basic Editor)
3.    Add the PI SDK reference (Tools --> References --> PISDK 1.x Type Library)
4.    Double-click on "ThisDisplay" in the project explorer
5.    Choose the desired Value object in the Object dropdown list (the first, at top-left corner)
6.    Choose the "ToolTipText" event in the Event dropdown list (the second, at top-right corner)
7.    Type the following code:

 
Private Sub Display_ToolTipText(ToolTip As String, valSymb As Symbol)                       
Dim ptPoint As PISDK.PIPoint                                                                
Dim tagName() As String                                                                     
' Parse the pi tag into an array using '\' as a delimiter
tagName = Split(valSymb.GetTagName(1), "\", -1)
' Is it a pi tag (\\server\tag --> split into three strings: Nothing, server, tagname)
If UBound(tagName) = 3 Then
Set ptPoint = PISDK.Servers(tagName(2)).PIPoints(tagName(3))
ToolTip = ToolTip & " " & ptPoint.PointAttributes("descriptor") & ""
End If

End Sub

 

Outcomes