How to bring TCursorTool in front of the grid lines

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Shimon
Newbie
Newbie
Posts: 22
Joined: Tue Nov 04, 2008 12:00 am

How to bring TCursorTool in front of the grid lines

Post by Shimon » Tue Dec 23, 2008 7:30 am

I added a file steema_shimon.zip to demonstrate my problem.

I need that the grid lines will be only on back and when there is a curosr line on the same line, then the cursor line will get priority and will be before the grid line.

In other words in the Z order : the cursor line should be on top and the grid lines should be lower.

Thanks,
Shimon

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

Post by Narcís » Tue Dec 23, 2008 8:57 am

Hi Shimon,

TCursorTool is already drawn over the axis grid lines. However, when its pen is set to certain colors it produces the effect you mention. You could try using TPenMode:

Code: Select all

  ChartTool1.Pen.Mode:=pmXor;
According to Delphi's documentation:

TPenMode indicates how a pen color interacts with the color of the canvas it is writing on. The following table lists the possible values:

Mode Pixel color

pmBlack Always black
pmWhite Always white
pmNop Unchanged
pmNot Inverse of canvas background color
pmCopy Pen color specified in Color property
pmNotCopy Inverse of pen color
pmMergePenNot Combination of pen color and inverse of canvas background
pmMaskPenNot Combination of colors common to both pen and inverse of canvas background.
pmMergeNotPen Combination of canvas background color and inverse of pen color
pmMaskNotPen Combination of colors common to both canvas background and inverse of pen
pmMerge Combination of pen color and canvas background color
pmNotMerge Inverse of pmMerge: combination of pen color and canvas background color
pmMask Combination of colors common to both pen and canvas background
pmNotMask Inverse of pmMask: combination of colors common to both pen and canvas background
pmXor Combination of colors in either pen or canvas background, but not both
pmNotXor Inverse of pmXor: combination of colors in either pen or canvas background, but not both


You can try if any of this possible values gives you a better result.
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

Shimon
Newbie
Newbie
Posts: 22
Joined: Tue Nov 04, 2008 12:00 am

Post by Shimon » Tue Dec 23, 2008 10:14 am

I have tried many modes - e.g.

Cursor.Pen.Color := clRed;
Cursor.Pen.Mode := pmBlack;

I am using TCursorTool which is created dynamically.

I can see that the color setting is done OK but the Mode is ignored and I guess it is always xoring but I want pmCopy.

Even when I tries pmBlack I received a red line...

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

Post by Narcís » Tue Dec 23, 2008 10:21 am

Hi Shimon,

Yes, this seems a bug to me and I added it (TV52013671) to the list to be fixed for future releases.
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

Shimon
Newbie
Newbie
Posts: 22
Joined: Tue Nov 04, 2008 12:00 am

Post by Shimon » Tue Dec 23, 2008 10:27 am

Is it because I dynamically created it ?

Any workaround ?

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

Post by Narcís » Tue Dec 23, 2008 10:29 am

Hi Shimon,

No, it's the same creating cursor tool at designtime. There's no workaround I can think of for now.
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

Shimon
Newbie
Newbie
Posts: 22
Joined: Tue Nov 04, 2008 12:00 am

Post by Shimon » Tue Dec 23, 2008 10:31 am

OK,

Thanks for your prompt responses.

1. When do you think a fix version will be released ?

2. Another related issue. Can I add some label which attached to the line. I am currently using TAnnotationTool but I need to manage its coordinates manually....

Thanks again,
Shimon

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

Post by Narcís » Tue Dec 23, 2008 10:35 am

Hi Shimon,

You're welcome.
1. When do you think a fix version will be released ?
I'm sorry but I can't provide an estimate date yet.
2. Another related issue. Can I add some label which attached to the line. I am currently using TAnnotationTool but I need to manage its coordinates manually....
Yes, you can use annotation tool set to custom position in cursor's OnChange event:

Code: Select all

procedure TForm1.ChartTool1Change(Sender: TCursorTool; x, y: Integer;
  const XValue, YValue: Double; Series: TChartSeries; ValueIndex: Integer);
begin
  With ChartTool2.Shape do
  begin
    CustomPosition:=True;
    Left:=Chart1.Axes.Bottom.CalcXPosValue(ChartTool1.XValue);
    Top:=Chart1.Axes.Left.CalcYPosValue(ChartTool1.YValue);
  end;
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
Image Image Image Image Image Image
Instructions - How to post in this forum

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

Re: How to bring TCursorTool in front of the grid lines

Post by Narcís » Mon Oct 05, 2009 1:38 pm

Hi Shimon,

I've been investigating TV52013671 and found that this is by design. The pen mode is set to pmXor when drawing the cursor probably for performance reasons.
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