CrDBGrid row color

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
hotdog
Posts: 3
Joined: Thu 19 Jan 2006 07:15
Location: Greece

CrDBGrid row color

Post by hotdog » Thu 19 Jan 2006 07:59

Is it possible to add these options to the CrDBgrid:
TCrDBgrid.RowColorWhenActive
TCrDBgrid.RowColorWhenInactive

This would replace a big amount of code on the CRDBGrid.OnDrawColumnCell event if someone likes to customize it.

sample code:

Code: Select all

begin
  if (ActiveControl = CrDBGrid1) then
  begin
    if (gdSelected in State) then
    begin
      CrDBGrid1.Canvas.Brush.Color := clRed;
      CRDBGrid1.Canvas.Font.Color := clWhite;
    end
    else
    begin
      CrDBGrid1.Canvas.Brush.Color := clWindow;
      CRDBGrid1.Canvas.Font.Color := clBlack;
    end;

    CrDBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
  end
  else { ActiveControl  CrDBGrid1 }
  begin
    if (gdSelected in State) then
    begin
      CrDBGrid1.Canvas.Brush.Color := clBlue;
      CRDBGrid1.Canvas.Font.Color := clWhite;
    end
    else
    begin
      CrDBGrid1.Canvas.Brush.Color := clWindow;
      CRDBGrid1.Canvas.Font.Color := clBlack;
    end;

    CrDBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
  end;
end;
btw I have read this topic:
http://crlab.com/forums/viewtopic.php?t=2629
and I believe the options for setting the rows color would be very convenient.

thanks,
Christos Michalislis

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 19 Jan 2006 15:19

We don't have plans to add such properties to the CrDBGrid. But you can create your own component inherited from the CrDBGrid to add any properties you want and override any events you need.

hotdog
Posts: 3
Joined: Thu 19 Jan 2006 07:15
Location: Greece

Post by hotdog » Thu 19 Jan 2006 21:09

Thanks for the reply.

I understand that you don't plan to add new features to the crdbgrid, but what about fixing any potential bugs? I'm a bit worried because I started using this component and I have some miror issues/bugs to report.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 20 Jan 2006 15:03

If you know about any critical errors in the CrDBGrid, send us descriptions of these errors and we will fix them

Post Reply