Hi,
Is there a way to change the TControl.cursor property of TCursorTool? It's the drag icon when you put the mouse pointer over the CursorTool. I'd like to remove it completely so the user won't try to drag the CursorTool. Well you see, the way to move the CursorTool in my software is by FollowMouse. So if the user click the CursorTool, it will turn FollowMouse on and another click will turn it off. But most users when the move the mouse over the CursorTool, seing the drag icon, they immediately try to click and drag the CursorTool, which is NOT what I want.
Anyway, changing the TCursorTool.Cursor doesn't do anything.
Thanks in advance.
TCursorTool.cursor?
-
- Newbie
- Posts: 12
- Joined: Wed Jun 01, 2005 4:00 am
- Location: wellington
- Contact:
Re: TCursorTool.cursor?
Disabling the drag cursor is a good suggestion, it would be useful for me too.
In the mean time you can set the ClickTolerance to 0 (instead of the default 3) to reduce the chance to see the drag icon.
In the mean time you can set the ClickTolerance to 0 (instead of the default 3) to reduce the chance to see the drag icon.
Re: TCursorTool.cursor?
Hello Bert,
I'm afraid it's not possible to disable the dragging appearance of the Cursor Tool. However it is possible to disable the AllowDrag property in the TColorLineTool so you could use mouse events to control two Color Lines. Her it is an example:
I'm afraid it's not possible to disable the dragging appearance of the Cursor Tool. However it is possible to disable the AllowDrag property in the TColorLineTool so you could use mouse events to control two Color Lines. Her it is an example:
Code: Select all
uses Series, TeeTools;
type
TColorLineClicked=(clcNone,clcHorizontal,clcVertical,clcBoth);
var ClickedMode: TColorLineClicked;
MouseX, MouseY: Integer;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart1.AddSeries(TPointSeries).FillSampleValues();
with Chart1.Tools.Add(TColorLineTool) as TColorLineTool do
begin
Axis:=Chart1.Axes.Bottom;
Value:=Chart1[0].XValues.MaxValue / 2;
AllowDrag:=false;
end;
with Chart1.Tools.Add(TColorLineTool) as TColorLineTool do
begin
Axis:=Chart1.Axes.Left;
Value:=Chart1[0].YValues.MinValue + Chart1[0].YValues.Range / 2;
AllowDrag:=false;
end;
ClickedMode:=clcNone;
end;
procedure TForm1.Chart1Click(Sender: TObject);
begin
if ClickedMode = clcNone then
begin
if (Chart1.Tools[0] as TColorLineTool).Clicked(MouseX, MouseY) then
ClickedMode:=clcVertical;
if (Chart1.Tools[1] as TColorLineTool).Clicked(MouseX, MouseY) then
begin
if ClickedMode=clcVertical then
ClickedMode:=clcBoth
else
ClickedMode:=clcHorizontal;
end;
end
else ClickedMode:=clcNone;
end;
procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
MouseX:=X;
MouseY:=Y;
if ((ClickedMode=clcBoth) or (ClickedMode=clcVertical)) then
(Chart1.Tools[0] as TColorLineTool).Value:=Chart1.Axes.Bottom.CalcPosPoint(X);
if ((ClickedMode=clcBoth) or (ClickedMode=clcHorizontal)) then
(Chart1.Tools[1] as TColorLineTool).Value:=Chart1.Axes.Left.CalcPosPoint(Y);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 12
- Joined: Wed Jun 01, 2005 4:00 am
- Location: wellington
- Contact:
Re: TCursorTool.cursor?
Reducing the drag tolerance wont help since I still need the cursors to be easily clickable to activate the followMouse.
So, no way at all to alter this than tinker with the source then? All good. Thanks anyway.
So, no way at all to alter this than tinker with the source then? All good. Thanks anyway.
Re: TCursorTool.cursor?
Hello,
If you want to add some tolerance to the TColorLineTool, you could do the "clicked" method manually as follows:
Doesn't it work as you want?
If you want to add some tolerance to the TColorLineTool, you could do the "clicked" method manually as follows:
Code: Select all
uses Series, TeeTools;
type
TColorLineClicked=(clcNone,clcHorizontal,clcVertical,clcBoth);
var ClickedMode: TColorLineClicked;
MouseX, MouseY, ClickTolerance: Integer;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart1.AddSeries(TPointSeries).FillSampleValues();
with Chart1.Tools.Add(TColorLineTool) as TColorLineTool do
begin
Axis:=Chart1.Axes.Bottom;
Value:=Chart1[0].XValues.MaxValue / 2;
AllowDrag:=false;
end;
with Chart1.Tools.Add(TColorLineTool) as TColorLineTool do
begin
Axis:=Chart1.Axes.Left;
Value:=Chart1[0].YValues.MinValue + Chart1[0].YValues.Range / 2;
AllowDrag:=false;
end;
ClickedMode:=clcNone;
ClickTolerance:=20;
end;
procedure TForm1.Chart1Click(Sender: TObject);
begin
if ClickedMode = clcNone then
begin
with (Chart1.Tools[0] as TColorLineTool) do
if (Abs(MouseX-Axis.CalcPosValue(Value))<ClickTolerance) then
ClickedMode:=clcVertical;
with (Chart1.Tools[1] as TColorLineTool) do
if (Abs(MouseY-Axis.CalcPosValue(Value))<ClickTolerance) then
begin
if ClickedMode=clcVertical then
ClickedMode:=clcBoth
else
ClickedMode:=clcHorizontal;
end;
end
else ClickedMode:=clcNone;
end;
procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
MouseX:=X;
MouseY:=Y;
if ((ClickedMode=clcBoth) or (ClickedMode=clcVertical)) then
(Chart1.Tools[0] as TColorLineTool).Value:=Chart1.Axes.Bottom.CalcPosPoint(X);
if ((ClickedMode=clcBoth) or (ClickedMode=clcHorizontal)) then
(Chart1.Tools[1] as TColorLineTool).Value:=Chart1.Axes.Left.CalcPosPoint(Y);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 12
- Joined: Wed Jun 01, 2005 4:00 am
- Location: wellington
- Contact:
Re: TCursorTool.cursor?
I'm a bit confused. Is TColorLineTool works the same way as TCursorTool?
Re: TCursorTool.cursor?
Hello,
Not exactly. They are designed for different purposes. Please, take a look at the examples in the features demo program included with the installation to have an idea about it.
Not exactly. They are designed for different purposes. Please, take a look at the examples in the features demo program included with the installation to have an idea about it.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |