Disabling CursorTool move action

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
nacho
Newbie
Newbie
Posts: 6
Joined: Tue Nov 09, 2010 12:00 am
Location: Orlando, FL, USA
Contact:

Disabling CursorTool move action

Post by nacho » Tue Nov 09, 2010 8:14 pm

Hi,
I have a TeeChart with a crosshair cursortool that follows the mouse. The crosshair is basically two cursor tool lines, one horizontal and one vertical. When the user moves the mouse the vertical and horizontal cursor tool lines snap to the next series point and the application shows the value for that specific data point. This approach works fine. However, if the user positions the mouse right on top of the cross the mouse cursor changes from "normal" to the "Move" cursor and they are given the choise to manually move the horizontal cursor tool line. Not sure why just the horizontal and not the vertical, but nevertheless, what I need is to keep the user from manually moving either one. The crosshair cursor must simply follow the mouse position snapping to the next series' value. How can I disable the ability to manually move the cursor tool lines? Basically disable the 'move' cursor for both cursor tool lines.

The following code shows how is that I'm creating the cursor tool:

private Steema.TeeChart.Tools.CursorTool _crossHairCursorV = null; // Interactive cross hair cursor tool (vertical line)
private Steema.TeeChart.Tools.CursorTool _crossHairCursorH = null; // Interactive cross hair cursor tool (horizontal line)

private void CreateCrosshairCursorTool(int seriesIndex)
{
// Remove cursor tool (if already available)
if (_crossHairCursorV != null)
MainTeeChart.Chart.Tools.Remove(_crossHairCursorV);

if (_crossHairCursorH != null)
MainTeeChart.Chart.Tools.Remove(_crossHairCursorH);

// Create vertical cursor tool
_crossHairCursorV = new Steema.TeeChart.Tools.CursorTool(MainTeeChart.Chart);
_crossHairCursorV.Pen.Width = 1; // Set initial width
_crossHairCursorV.Pen.Color = Color.Black; // Set initial color
_crossHairCursorV.FastCursor = false;
_crossHairCursorV.FollowMouse = true;
_crossHairCursorV.Snap = true;
_crossHairCursorV.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
_crossHairCursorV.SnapStyle = Steema.TeeChart.Tools.SnapStyle.Vertical;
_crossHairCursorV.SnapChange += new Steema.TeeChart.Tools.CursorChangeEventHandler(cursorToolVertical_SnapChange);

// Create horizon8tal cursor tool and attach to main chart
_crossHairCursorH = new Steema.TeeChart.Tools.CursorTool(MainTeeChart.Chart);
_crossHairCursorH.Pen.Width = 1; // Set initial width
_crossHairCursorH.Pen.Color = Color.Black; // Set initial color
_crossHairCursorH.FastCursor = false;
_crossHairCursorH.FollowMouse = false; // Horizontal position is calculated based on series value at vertical position
_crossHairCursorH.Snap = true;
_crossHairCursorH.Style = Steema.TeeChart.Tools.CursorToolStyles.Horizontal;
_crossHairCursorH.SnapStyle = Steema.TeeChart.Tools.SnapStyle.Horizontal;

// Attach cursor tool to indicated series
if (seriesIndex >= 0)
{
_crossHairCursorV.Series = MainTeeChart.Series[seriesIndex]; // Set cursor tool to follow indicated series
_crossHairCursorH.Series = MainTeeChart.Series[seriesIndex]; // Set cursor tool to follow indicated series
}

_cursorToolVisible = true;
}
Ignacio Salvo

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Disabling CursorTool move action

Post by Narcís » Wed Nov 10, 2010 8:21 am

Hi Ignacio,

That's because _crossHairCursorH.FollowMouse is set to false. You could either set it to true or use one single CursorTool with Style being CursorToolStyles.Both for each series instead of 2 cursors.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply