11 Replies Latest reply on Jan 9, 2012 1:21 PM by andreas

    Trend cursor disappears upon addition of new tag programatically

    tambijagdish

      We are trying to programatically persists PB Trend cursor. We are passing tag into PB trend based upon click event of PI PB Symbol and then we add the cursor on the trend manually. When an another tag is added by clicking new PB symbol, the new tag is added into the trend and the cursor disappears. Below is the snippet of code which we are trying. With this code when we debug the VBA step by step, we are able to persists cursor but in the run mode it is not. Not sure why the behavior is different. PB version 3.2.0.0

       
      Public Sub cursor_time()
          If ThisDisplay.Trend.CursorCount <> 0 Then 
             ReDim arrCursorTime(1 To ThisDisplay.Trend.CursorCount) 
          End If 
          For i = 1 To ThisDisplay.Trend.CursorCount 
              ThisDisplay.Trend.CurrentCursor = i 
              arrCursorTime(i) = ThisDisplay.Trend.CursorTime 
              bool_cursor_exist = True 
          Next 
      End Sub 
      
      Public Sub set_cursor() 
          If ThisDisplay.Trend.TraceCount <> 0 Then 
              If bool_cursor_exist Then 
                  bool_cursor_check = False 
                  For i = 1 To UBound(arrCursorTime) 
                      ThisDisplay.Trend.AddCursor 
                      'MsgBox ThisDisplay.Trend.CurrentCursor 
                      ThisDisplay.Trend.CurrentCursor = i 
                      ThisDisplay.Trend.CursorTime = arrCursorTime(i) 
                  Next 
                  bool_cursor_exist = False 
                  bool_cursor_check = True 
              End If 
          End If 
      End Sub