Quantcast
Channel: OSIsoft Users Community
Viewing all articles
Browse latest Browse all 1120

Cursors on all trends could be a wonderful thing

$
0
0

I want some of my trend displays to open with a cursor on each trend.  Of course I plagiarized some nifty code and adapted it, and it works great when I run it.  But when executed via the displays open event all the cursors show "no data" I think because it places the cursors before the trends have data.  What should I do?  !!  

 

Here is my code:

 

 

Private Sub Display_Open()
 
    Call SetTrendCursors
 
End Sub
 
    Function SetTrendCursors()
 
    Dim TrendCnt As Integer
    Dim Ndx As Integer
    Dim SymType As Long
    Dim NumCursors As Integer
    Dim ThisCursor As Integer
       TrendCnt = ThisDisplay.Symbols.Count        ' Find out how many symbols are on the display page
    ' Walk down the list of Symbols and if the Symbol is a Trend, Set a Cursor
    For Ndx = 1 To TrendCnt
        SymType = ThisDisplay.Symbols.Item(Ndx).Type
        If SymType = pbSYMBOLTYPE.pbSymbolTrend Then
            
            'Remove All Cursors
            While ThisDisplay.Symbols.Item(Ndx).CursorCount > 0
                ThisDisplay.Symbols.Item(Ndx).RemoveCursor (1) ' ThisDisplay.Symbols.Item(Ndx).CurrentCursor
            Wend
            Call ThisDisplay.Symbols.Item(Ndx).AddCursor
        End If
    Next
End Function
 

Viewing all articles
Browse latest Browse all 1120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>