I have a TCursorTool on a chart. It's Style is both. The horizontal and vertical sizes are both set to 10. This makes the cursor appear as a cross-hair. When the mouse cursor is anywhere on the chart, whenever it crosses the projection of the cursor lines, the mouse pointer changes to indicate that the TCursorTool is below the mouse. You can also click and drag at that point, even though the visible TCursorTool is far from the mouse pointer. Is there a way to restrict this behavior to the 10 pixels that are actually visible.
That may be a little cryptic. As an example, if the TCursorTool is positioned at 0,0, then when the mouse pointer passes over 1000, 0, it changes, and I can click and drag the TCursorTool from there, even though the mouse is nowhere near the TCursorTool. This could be very confusing to a user.
Scope of TCursorTool grabbing mouse cursor
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Scope of TCursorTool grabbing mouse cursor
Hi skassan,
The only solution I can think of for now is doing something like this:
Anyway, I'll add your request to the wish-list to be considered for inclusion in future releases.
The only solution I can think of for now is doing something like this:
Code: Select all
uses TeCanvas;
procedure TForm4.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var R: TRect;
tmpX, tmpY: Integer;
tmp: Boolean;
begin
tmpX:=Chart1.Axes.Bottom.CalcXPosValue(ChartTool1.XValue);
tmpY:=Chart1.Axes.Left.CalcYPosValue(ChartTool1.YValue);
R.Left:=tmpX - ChartTool1.HorizSize div 2;
R.Top:=tmpY - ChartTool1.VertSize div 2;
R.Right:=R.Left + ChartTool1.HorizSize;
R.Bottom:=R.Top + ChartTool1.VertSize;
tmp:=PointInRect(R, X, Y);
Chart1.AutoRepaint:=tmp;
ChartTool1.Active:=tmp;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |