EhLib.Com
https://forum.ehlib.com/en/

how to highlight current column
https://forum.ehlib.com/en/viewtopic.php?f=5&t=792
Page 1 of 1

Author:  geohuazai [ 21 Nov 2017, 07:07 ]
Post subject:  how to highlight current column

Hi Dear Team,
Good day.
Is there a way to highlight current column title when the current cell is moving around the DBGridEh?
My use case is: Too many columns in the grid, the user couldn't easily find which column he is working on.
Thanks.

Attachments:
change col title color.jpg
change col title color.jpg [ 57.45 KiB | Viewed 3044 times ]

Author:  geohuazai [ 03 Dec 2019, 07:26 ]
Post subject:  Re: how to highlight current column

UP
geohuazai wrote:
Hi Dear Team,
Good day.
Is there a way to highlight current column title when the current cell is moving around the DBGridEh?
My use case is: Too many columns in the grid, the user couldn't easily find which column he is working on.
Thanks.

Author:  EhLibSupport [ 03 Dec 2019, 18:37 ]
Post subject:  Re: how to highlight current column

Hello

Yes, you can.
Use TDBGridEh.OnGetTitleParams event like this.

Code:
procedure TForm1.FormCreate(Sender: TObject);
begin
  DBGridEh1.TitleParams.FillStyle := cfstGradientEh;
end;

procedure TForm1.DBGridEh1ColEnter(Sender: TObject);
begin
  DBGridEh1.InvalidateTitle;
end;

procedure TForm1.DBGridEh1GetTitleParams(Grid: TCustomDBGridEh;
  Params: TDBGridDrawTitleCellParamsEh);
begin
  if (Params.Column.Index = DBGridEh1.SelectedIndex) then
  begin
    Params.Color := clWebOrange;
  end;
end;


Attachments:
sshot-62.png
sshot-62.png [ 29.74 KiB | Viewed 1845 times ]

Author:  danieldavila [ 11 Dec 2019, 12:10 ]
Post subject:  Re: how to highlight current column

Is it possible to do this in the EhLib source code so you don't have to repeat this encoding every time you need it? Because I tried to implement and it didn't work

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/