TeeGrid color questions

TeeGrid VCL / FMX for Embarcadero RAD Studio, Delphi, C++ Builder and Lazarus Free Pascal.
Post Reply
TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

TeeGrid color questions

Post by TheOtherPrefontaine » Wed Sep 20, 2023 3:08 pm

My question has to do with setting the header brush color directly. Can it be done?

I use TeeGrid1.Back.Brush.Color for the background.
I use TeeGrid1.Rows.Format.Font.Color to set the overall font color
I use TeeGrid1.Header.Format.Font.Color to set the header font color

For instance to set the header brush/background color to claBlack, how can I do it?

Yeray
Site Admin
Site Admin
Posts: 9534
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeeGrid color questions

Post by Yeray » Thu Sep 21, 2023 8:09 am

Hello,

You can use properties under Header.Format.Brush. Note you may need to hide the Gradient so the Solid Brush can be drawn. Ie:

Code: Select all

  TeeGrid1.Header.Format.Brush.Gradient.Hide;
  TeeGrid1.Header.Format.Brush.Color:=clGreen;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

TheOtherPrefontaine
Newbie
Newbie
Posts: 17
Joined: Tue Aug 22, 2023 12:00 am

Re: TeeGrid color questions

Post by TheOtherPrefontaine » Fri Sep 22, 2023 12:25 am

Perfect! Thanks very much.

InfraTec
Newbie
Newbie
Posts: 16
Joined: Tue May 09, 2023 12:00 am

Re: TeeGrid color questions

Post by InfraTec » Thu Feb 01, 2024 1:53 pm

I used this example to colorize the header, but now unfortunately the header lines of the last visible column (left and right) are not drawn:
Attachments
HeaderExample.JPG
HeaderExample.JPG (11.56 KiB) Viewed 2696 times

Yeray
Site Admin
Site Admin
Posts: 9534
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeeGrid color questions

Post by Yeray » Fri Feb 02, 2024 7:29 am

Hello,

Do you have a simple example we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

InfraTec
Newbie
Newbie
Posts: 16
Joined: Tue May 09, 2023 12:00 am

Re: TeeGrid color questions

Post by InfraTec » Fri Feb 02, 2024 8:31 am

Here is my example:
Attachments
HeaderColorExample.zip
(90.1 KiB) Downloaded 380 times

Yeray
Site Admin
Site Admin
Posts: 9534
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeeGrid color questions

Post by Yeray » Tue Feb 06, 2024 7:43 am

Hello,

This is already fixed so the next release should include this fix.
Here the diff if you want to try to apply it to your sources without having to wait for the next release:

Code: Select all

diff --git a/Sources/Tee.Grid.Bands.Columns.pas b/Sources/Tee.Grid.Bands.Columns.pas
index 73d332e0..baa6bb0b 100644
--- a/Sources/Tee.Grid.Bands.Columns.pas
+++ b/Sources/Tee.Grid.Bands.Columns.pas
@@ -695,25 +695,32 @@ var
 
   procedure DrawColumns(const AColumns:TVisibleColumns);
 
-    procedure DrawLine(const AColumn:TColumn);
+    procedure DrawLine(const AColumn:TColumn; const IsLast:Boolean);
     var tmpR : TRectF;
     begin
       tmpR:=AdjustBounds(AColumn,AData.Bounds);
+
       AData.Painter.VerticalLine(AColumn.Left-tmpHalf,tmpR.Top,tmpBottom);
+
+      if IsLast then
+         AData.Painter.VerticalLine(AColumn.Right-tmpHalf,tmpR.Top,tmpBottom);
     end;
 
     function CanPaintLine(const AColumn:TColumn):Boolean;
     begin
       if AColumn.Locked=TColumnLocked.None then
-         result:=(AColumn.Left>=IVisible.NonLocked.Left) and
-                 (AColumn.Right<=IVisible.NonLocked.Right)
+         result:=(AColumn.Right>=IVisible.NonLocked.Left) and
+                 (AColumn.Left<=IVisible.NonLocked.Right)
       else
          result:=True;
     end;
 
   var t : Integer;
-      tmp : TColumn;
+      tmp,
+      tmpLast : TColumn;
   begin
+    tmpLast:=AColumns.Last;
+
     for t:=0 to AColumns.Count-1 do
     begin
       tmp:=AColumns[t];
@@ -722,7 +729,7 @@ var
          break
       else
       if CanPaintLine(tmp) then
-         DrawLine(tmp);
+         DrawLine(tmp,tmp=tmpLast);
     end;
   end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

InfraTec
Newbie
Newbie
Posts: 16
Joined: Tue May 09, 2023 12:00 am

Re: TeeGrid color questions

Post by InfraTec » Fri Feb 23, 2024 1:08 pm

Thank you for the fix. It works for the last line. But unfortunately the header lines are now shifted slightly right.
You can see this with my example program.

Marc
Site Admin
Site Admin
Posts: 1217
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TeeGrid color questions

Post by Marc » Thu Feb 29, 2024 12:35 pm

Hello,

We'll be publishing the fix very soon, there may be a subtle difference to your code.

Regards,
Marc Meumann
Steema Support

Post Reply