Recent

Author Topic: Grid Cell Hints Do Not Show When dgAlwaysShowEditor Option Is Used  (Read 1391 times)

emhartner

  • Jr. Member
  • **
  • Posts: 59
On my TDBGrid, I have the dgCellHints option checked and also have ShowHints set to True.  When dgAlwaysShowEditor is not checked, all works as expected.  However, when dgAlwaysShowEditor is checked - no cell hints show.  The OnGetCellHint fires, but the hint is not displayed.

Any help would be appreciated.

Thank you,
Eric

dsiders

  • Hero Member
  • *****
  • Posts: 1179
Re: Grid Cell Hints Do Not Show When dgAlwaysShowEditor Option Is Used
« Reply #1 on: April 08, 2024, 05:50:57 pm »
On my TDBGrid, I have the dgCellHints option checked and also have ShowHints set to True.  When dgAlwaysShowEditor is not checked, all works as expected.  However, when dgAlwaysShowEditor is checked - no cell hints show.  The OnGetCellHint fires, but the hint is not displayed.

Any help would be appreciated.

Thank you,
Eric

Is dgCellHints also included in TDBGrid.Options?
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

wp

  • Hero Member
  • *****
  • Posts: 12143
Re: Grid Cell Hints Do Not Show When dgAlwaysShowEditor Option Is Used
« Reply #2 on: April 08, 2024, 06:38:14 pm »
In grids.pas (in folder lcl of your Lazarus installation) find procedure TCustomGrid.ShowCellHintWindow. Close to its end you'll see
Code: Pascal  [Select][+][-]
  1.   if not EditorMode and not (csDesigning in ComponentState) then begin
  2.     Hint := txt;
  3.     //set Application.Hint as well (issue #0026957)
  4.     Application.Hint := GetLongHint(AppHint);
  5.     Application.ActivateHint(APoint, true);
  6.   end else
  7.     HideCellHintWindow;  

Comment out the words "not EditorMode and", and it should work.
Code: Pascal  [Select][+][-]
  1.   if {not EditorMode and} not (csDesigning in ComponentState) then begin
  2.     Hint := txt;
  3.   ...

The fact that EditorMode is checked must have a meaning, but I don't know why. It makes me hesitant to commit this change to the repository. Please work with this change for a while and report back whether you noticed any side-effects.

emhartner

  • Jr. Member
  • **
  • Posts: 59
Re: Grid Cell Hints Do Not Show When dgAlwaysShowEditor Option Is Used
« Reply #3 on: April 08, 2024, 09:07:03 pm »
In grids.pas (in folder lcl of your Lazarus installation) find procedure TCustomGrid.ShowCellHintWindow. Close to its end you'll see
Code: Pascal  [Select][+][-]
  1.   if not EditorMode and not (csDesigning in ComponentState) then begin
  2.     Hint := txt;
  3.     //set Application.Hint as well (issue #0026957)
  4.     Application.Hint := GetLongHint(AppHint);
  5.     Application.ActivateHint(APoint, true);
  6.   end else
  7.     HideCellHintWindow;  

Comment out the words "not EditorMode and", and it should work.
Code: Pascal  [Select][+][-]
  1.   if {not EditorMode and} not (csDesigning in ComponentState) then begin
  2.     Hint := txt;
  3.   ...

The fact that EditorMode is checked must have a meaning, but I don't know why. It makes me hesitant to commit this change to the repository. Please work with this change for a while and report back whether you noticed any side-effects.

Thanks wp!  This did the trick.  As you are saying, it was probably added for a reason.  Anyway, I'll work with this for a bit and report back.  Thanks again.

emhartner

  • Jr. Member
  • **
  • Posts: 59
Re: Grid Cell Hints Do Not Show When dgAlwaysShowEditor Option Is Used
« Reply #4 on: May 20, 2024, 10:22:55 pm »
Just following up with wp to let you know that I've not seen any issues so far with this change.

Bart

  • Hero Member
  • *****
  • Posts: 5317
    • Bart en Mariska's Webstek
Re: Grid Cell Hints Do Not Show When dgAlwaysShowEditor Option Is Used
« Reply #5 on: May 20, 2024, 10:37:35 pm »
The fact that EditorMode is checked must have a meaning, but I don't know why. It makes me hesitant to commit this change to the repository. Please work with this change for a while and report back whether you noticed any side-effects.

Git blame shows commit 30f5f0b0 introduced this, because of issue #35453 .

Bart

Zoran

  • Hero Member
  • *****
  • Posts: 1842
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Grid Cell Hints Do Not Show When dgAlwaysShowEditor Option Is Used
« Reply #6 on: May 21, 2024, 12:45:55 am »
The fact that EditorMode is checked must have a meaning, but I don't know why. It makes me hesitant to commit this change to the repository. Please work with this change for a while and report back whether you noticed any side-effects.

Git blame shows commit 30f5f0b0 introduced this, because of issue #35453 .

Bart

I don't think so. Take a look at the diff in the link you gave, "not EditorMode" had been there before:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/commit/30f5f0b09d82d765e00bf56658accc223dc1c853#a49ad8c0b361add7a24d0f69ecb81f35f26ce616_4024_4013

 

TinyPortal © 2005-2018