Page 1 of 1

Disable TeeCursor.

Posted: Fri Apr 21, 2006 7:46 am
by 9530613
Hello Support Team,

I have one asTeeCursor and property FollowMouse is True. I want to disable this cursor on Double Click. How do it ? Disabled cursor can't move and cursor pointer should not change.

Best regards, Rustam.

Posted: Fri Apr 21, 2006 8:04 am
by narcis
Hi Rustam,

You can implement something like that on TeeChart's OnDblClick event doing something like this:

Code: Select all

Private Sub TChart1_OnDblClick()
    TChart1.Tools.Items(0).Active = Not TChart1.Tools.Items(0).Active
    'or
    'TChart1.Tools.Items(0).asTeeCursor.FollowMouse = Not TChart1.Tools.Items(0).asTeeCursor.FollowMouse
End Sub

Wrong

Posted: Fri Apr 21, 2006 9:07 am
by 9530613
narcis wrote:Hi Rustam,

You can implement something like that on TeeChart's OnDblClick event doing something like this:

Code: Select all

Private Sub TChart1_OnDblClick()
    TChart1.Tools.Items(0).Active = Not TChart1.Tools.Items(0).Active
    'or
    'TChart1.Tools.Items(0).asTeeCursor.FollowMouse = Not TChart1.Tools.Items(0).asTeeCursor.FollowMouse
End Sub
It is not correct. In first case (Active=False) the cursor disappears absolutely. In second case (FollowMouse=False) cursor pointer changes when it's on the line of asTeeCursor

Rustam.

Posted: Mon Apr 24, 2006 10:11 am
by Pep
Hi Rustam,

yes, in that case if you want to hide the mouse cursor the only way I can think of is by using the Canvas techniques to simulate a cursor. This will allow you to customize the aspect and enable or disable ti when you want.
An example of cursor using the canvas could be :

Code: Select all

Private Sub Form_Load()
 TChart1.Series(0).FillSampleValues 20
 TChart1.Series(1).FillSampleValues 20
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
 Dim xx, yy, i
 Dim InChart As Boolean

 xpos = X
 ypos = Y

 InChart = True

 With TChart1
  'Optionally use .Aspect.Width3D and Height3D to set Line to plane of Series
  'in a 3D Chart - recommend use of 2D for simplicity
  If X <= .Axis.Left.Position Then
    X = .Axis.Left.Position + 1
    InChart = False
    LastValueY = 0
  End If

  If X > .Axis.Right.Position Then
    X = .Axis.Right.Position - 1
    InChart = False
    LastValueY = .Series(0).Count - 1
  End If

  .Canvas.Brush.Style = bsClear
  .Repaint
  If .SeriesCount > 0 Then
   For s = 0 To .SeriesCount - 1
    If .Series(s).Count > 0 Then
     If InChart = True Then
       For i = .Axis.Top.Position To .Axis.Bottom.Position
        If .Series(s).Clicked(X, i) <> -1 Then
          Exit For
        End If
       Next i
       .Canvas.TextOut 10, 10 + (10 * s), "Series " & s & " Value: " & CInt(.Series(s).YScreenToValue(i))
     Else
      .Canvas.TextOut 10, 10 + (10 * s), "Series " & s & " Value: " & CInt(.Series(s).YValues.Value(LastValueY))
     End If
    End If
   Next s
  End If

  '.Canvas.Pen.Style = psDot
  '.Canvas.Pen.Color = vbWhite
  .Canvas.Pen.Color = vbBlue
  .Canvas.MoveTo X, .Axis.Top.Position
  .Canvas.LineTo X, .Axis.Bottom.Position
 End With
End Sub

*

Posted: Tue Apr 25, 2006 8:09 am
by 9530613
I think that this will work slowly and to cause blinking on big surfaces (1024x1024),

*

Posted: Tue Apr 25, 2006 8:09 am
by 9530613
I think that this will work slowly and to cause blinking on big surfaces (1024x1024),

Posted: Thu Apr 27, 2006 11:31 pm
by Pep
Hi,

I'm afraid that there's not other way that I'm aware of.