![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | Color mapping font of for treenodes | ||
|---|---|---|---|
| Product: | VCL TeeChart | Reporter: | h.hasenack <hans> |
| Component: | TTree | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | RESOLVED FIXED | ||
| Severity: | major | CC: | david, hans |
| Priority: | High | ||
| Version: | 131119 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | RAD XE5 |
Fixed with the code below.
But, there is a (minor) problem with "system" colors like "clWindowText" etc.
When using GDI+ canvas (the default canvas now), colors are expressed using the 4 bytes of a Cardinal (RGBA format) instead of just 3 bytes (RGB).
That means, GDI+ does not interpret and does not know if a color is a "system" color by looking at the 4 byte. This is only a VCL mechanism intended only for "old" GDI. The 4 byte (A) is used to determine the transparency from 0 to 255.
In GDI+, a "clWindowText" color ($FF000008) is a perfect valid color, (a totally transparent RGB with Red=8), and so, when calling ColorToRGB it will be converted (in VCL only). FireMonkey follows GDI+ specs (4 bytes RGBA and no special system colors).
{$IFNDEF FMX}
{$IFNDEF LCL}
{$IFNDEF CLX}
var tmpColor : TColor;
{$ENDIF}
{$ENDIF}
{$ENDIF}
.....
{$IFNDEF FMX}
{$IFNDEF LCL}
{$IFNDEF CLX}
tmpColor:=ACanvas.Font.Color;
if (Cardinal(tmpColor)>={$IFDEF D7}clSystemColor{$ELSE}$80000000{$ENDIF}) and
(Cardinal({$IFDEF D6}clMenuBar{$ELSE}clInfoBk{$ENDIF})>=Cardinal(tmpColor)) then
ACanvas.Font.Color:=ColorToRGB(tmpColor);
{$ENDIF}
{$ENDIF}
{$ENDIF}
|
As for my previous reported patch on TeeTree panel, there is another issue for drawing the text of TTreeNodeshape. The system color values (like clWindowText) are not mapped into rgb values, and as these system values are negative, they are drawn as transparent values, thus become invisible. Here's the fix I come up with: Procedure TTreeNodeShape.SetCanvasFont(const ACanvas:TCanvas3D); begin if not Assigned(Tree) then ACanvas.AssignFont(InternalFont) else with Tree do if Self.FSelected and (Selected.TextColor<>clNone) and (not Designing) then begin ACanvas.AssignFont(InternalFont); ACanvas.Font.Color:=Selected.TextColor; end else begin // HotTrack ... if IMouseInside and (not Designing) and HotTrack.Active then begin if HotTrack.UseFont then ACanvas.AssignFont(HotTrack.Font) else if HotTrack.HotLink then begin ACanvas.AssignFont(InternalFont); with ACanvas.Font do Style:=Style+[{$IFDEF FMX}TFontStyle.{$ENDIF}fsUnderline]; end; end else ACanvas.AssignFont(InternalFont); end; {$ifdef HH_PATCH_TEETREE} aCanvas.Font.Color:=ColorToRGB(aCanvas.Font.Color); {$endif} end;