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

How to show a Hint in the Footer of a Grid ?
https://forum.ehlib.com/en/viewtopic.php?f=5&t=1177
Page 1 of 1

Author:  Luciano_F [ 20 Sep 2022, 20:08 ]
Post subject:  How to show a Hint in the Footer of a Grid ?

I enabled

EhGrid.SumList.Active := True

And in the column there is

Footer.ToolTips := True

I would like to show Hint only in Footer

Attachments:
Hint Footer Grid.png
Hint Footer Grid.png [ 38.57 KiB | Viewed 1532 times ]

Author:  EhLibSupport [ 21 Sep 2022, 16:00 ]
Post subject:  Re: How to show a Hint in the Footer of a Grid ?

Hello

The Footer.ToolTips property is designed to display the footer text when the text does not fit in the footer cell.
In the footer, unfortunately, there are no settings for displaying the Hint, i.e. custom text.

Author:  Luciano_F [ 21 Sep 2022, 18:49 ]
Post subject:  Re: How to show a Hint in the Footer of a Grid ?

Is there any way or hack I can do this ?

Author:  EhLibSupport [ 21 Sep 2022, 21:46 ]
Post subject:  Re: How to show a Hint in the Footer of a Grid ?

Hello

I only see a modification of the grid code here.

Code:
procedure TCustomDBGridEh.CMHintShow(var Message: TCMHintShow);

....
      else if (FullFooterRowCount > 0) and
              (Cell.Y > RowCount - 1) then
....
        begin
          Footer := Column.ColumnUsedFooter(Cell.Y - RowCount - DataGrouping.Footers.VisibleItemsCount);

          //New code
          if Column.DynProps.FindDynVar('FooterHint') <> nil then
          begin
            phi := Message.HintInfo;
            phi.CursorRect := ARect;
            phi.HintStr := Column.DynProps['FooterHint'].AsString;
            Processed := True;
          end;
          //\\New code

          if not Footer.ToolTips then Exit;
          FHintFont.Assign(Footer.Font);
          Canvas.Font.Assign(FHintFont);
          WordWrap := Footer.WordWrap;
          AAlignment := Footer.Alignment;
          S := GetFooterValue(Footer, Column);
          FBackground := Footer.Color;
          GetFooterParams(RawToDataColumn(Cell.X), Cell.Y - RowCount, Column,
            Canvas.Font, FBackground, AAlignment, [], S);
        end;




The hint text is stored in the Column.DynProps with FooterHint name.
So you need to create DynProp line this:


Code:
procedure TForm1.FormCreate(Sender: TObject);
begin
  DBGridEh1.Columns[0].DynProps.CreateDynVar('FooterHint', 'Footer Hint');
end;

Author:  Luciano_F [ 22 Sep 2022, 11:35 ]
Post subject:  Re: How to show a Hint in the Footer of a Grid ?

It worked but you can leave this code already fixed there in your sources?
Otherwise every time I change my version of EhLib I will have to change the source code before installing.

Author:  Luciano_F [ 30 Sep 2022, 10:10 ]
Post subject:  Re: How to show a Hint in the Footer of a Grid ?

EhLibSupport wrote:
Hello

I only see a modification of the grid code here.

Code:
procedure TCustomDBGridEh.CMHintShow(var Message: TCMHintShow);

....
      else if (FullFooterRowCount > 0) and
              (Cell.Y > RowCount - 1) then
....
        begin
          Footer := Column.ColumnUsedFooter(Cell.Y - RowCount - DataGrouping.Footers.VisibleItemsCount);

          //New code
          if Column.DynProps.FindDynVar('FooterHint') <> nil then
          begin
            phi := Message.HintInfo;
            phi.CursorRect := ARect;
            phi.HintStr := Column.DynProps['FooterHint'].AsString;
            Processed := True;
          end;
          //\\New code

          if not Footer.ToolTips then Exit;
          FHintFont.Assign(Footer.Font);
          Canvas.Font.Assign(FHintFont);
          WordWrap := Footer.WordWrap;
          AAlignment := Footer.Alignment;
          S := GetFooterValue(Footer, Column);
          FBackground := Footer.Color;
          GetFooterParams(RawToDataColumn(Cell.X), Cell.Y - RowCount, Column,
            Canvas.Font, FBackground, AAlignment, [], S);
        end;




The hint text is stored in the Column.DynProps with FooterHint name.
So you need to create DynProp line this:


Code:
procedure TForm1.FormCreate(Sender: TObject);
begin
  DBGridEh1.Columns[0].DynProps.CreateDynVar('FooterHint', 'Footer Hint');
end;



It worked but you can leave this code already fixed there in your sources?
Otherwise every time I change my version of EhLib I will have to change the source code before installing.

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