3 Replies Latest reply on Feb 8, 2011 12:58 PM by cpl

    dropcursor addcursor removecursor

    cpl

      I've got several trends on a PDI. From any given trend, i am using the DropCursor to perform an AddCursor to the remaining trends so that all trends will show cursor values base off the original DropCursor.  Now I've got 'x' number of trends all displaying the same cursor time and associated values. When I remove a cursor from a trend (by dragging it off the trend), I would like all corresponding cursors on the other trends to be removed. Unfortunately the DropCursor function is not called when dragging a cursor off a trend. Ideas on how I can make this work? Below is a code snippet of how the cursors are set.

       
      Dim myTrends() As Trend, myTrend As Trend
      
      Private Sub Trend1_DropCursor(bCancel As Boolean, ByVal nCursor As Integer, ByVal NewTime As String)
      
          Set myTrend = Trend1
          myTrend.CurrentCursor = nCursor
          myTrend.CursorTime = NewTime
      
      
      End Sub
      
      Private Sub doTrendCursor()
      Dim xx As Integer, yy As Integer
      
      For xx = 0 To UBound(myTrends)
          If myTrends(xx).Name <> myTrend.Name Then
              For yy = myTrends(xx).CursorCount To 1 Step -1
                  myTrends(xx).RemoveCursor (yy)
              Next
              For yy = 1 To myTrend.CursorCount
                  myTrend.CurrentCursor = yy
                  myTrends(xx).AddCursor
                  myTrends(xx).CurrentCursor = myTrend.CurrentCursor
                  myTrends(xx).CursorTime = myTrend.CursorTime
              Next
          End If
      Next
      
      End Sub
      

       

        • Re: dropcursor addcursor removecursor
          andreas

          I am not aware of an event for removing the cursor. If you are dragging it off the trend - you might use the Click event and check:

           
          Private Sub Trend1_Click(ByVal lvarX As Long, ByVal lvarY As Long)
              While Trend1.CursorCount < Trend2.CursorCount
                  Trend2.RemoveCursor (Trend2.CursorCount)
              Wend
          End Sub
          

          Alternatively you could work with the MouseOver event or any other event that gets regulary fired:

           
          Private Sub Trend1_MouseOver()
              While Trend1.CursorCount < Trend2.CursorCount
                  Trend2.RemoveCursor (Trend2.CursorCount)
              Wend
          End Sub