View Issue Details

IDProjectCategoryView StatusLast Update
0026957LazarusLCLpublic2016-05-25 11:22
ReportermhigginsAssigned ToBart Broersma 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWin 7OSOS Version
Product Version1.2.6Product Build 
Target Version1.4Fixed in Version1.4 
Summary0026957: TCustomGrid: Application.Hint not set when using CellHints
DescriptionI am trying to get different hints for cells in a StringGrid.

I use OnGetCellHints

begin
 case arow of
  0 : HintText:='|Weighted regression intercept and one sigma error';
  1 : HintText:='|Weighted regression slope and one sigma error';
  2 : HintText:='|Weighted regression volume and one sigma error';
  3 : HintText:= '|If Q > 0.1 then goodness of fit is acceptable';
  end;
  application.ProcessMessages;
end;

I have selected gocellhints in options.
Showhints is true

OnGetCellHints is not triggered by mouse movements.

There are no other events selected
TagsNo tags attached.
Fixed in Revisionr46760
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

Bart Broersma

2014-10-28 18:23

developer   ~0078705

Last edited: 2014-10-29 00:01

View 2 revisions

I cannot reprodce this in trunk (Lazarus 1.3 r46593 FPC 2.6.4 i386-win32-win32/win64).
It also works in fixes 1.2 branch (Lazarus 1.2.7 r46696 FPC 2.6.2 i386-win32-win32/win64).

procedure TForm1.SGridGetCellHint(Sender: TObject; ACol, ARow: Integer;
  var HintText: String);
begin
  writeln('OnGetCellHint: ACol = ',ACol,' ARow = ',ARow);
end;

It outputs:
OnGetCellHint: ACol = 0 ARow = 4
OnGetCellHint: ACol = 1 ARow = 4
OnGetCellHint: ACol = 0 ARow = 4
OnGetCellHint: ACol = 0 ARow = 3
OnGetCellHint: ACol = 0 ARow = 2
etc.

You need to have goCellHints or goTruncCellHints in Options to make it work.

mhiggins

2014-10-30 03:08

reporter   ~0078732

I have now reinstalled 1.2.6 - latest public version. (46529)

OnGetCellHints is now triggered corrected, but the text in hinttext is not transferred to the application.

goCellHints is true. It makes no difference if goTruncCellHints is true or false

Bart Broersma

2014-11-03 13:24

developer   ~0078857

Last edited: 2014-11-03 13:27

View 3 revisions

Again: this works for me:
(Tested with truk and Fixes_1_2)

procedure TForm1.SGridGetCellHint(Sender: TObject; ACol, ARow: Integer;
  var HintText: String);
begin
  writeln('OnGetCellHint: ACol = ',ACol,' ARow = ',ARow);
  HintText := Format('ACol = %d, ARow = %d',[ACol,ARow]);
end;

Did you remeber to set ShowHint = True for the StringGrid?

PS. You can try the example in ($lazarus)/examples/gridexamples/columneditors

mhiggins

2014-11-05 02:07

reporter   ~0078909

Hello - I found the problem - it was more subtle than I thought.

If I use a simple hint (hinttext = 'Test') then it displays correctly - as you found.
However, I was trying to redirect the hints to a status panel (s_b)using

In formcreate

application.OnHint:=HintFire;

procedure TForm1.Hintfire(sender: TObject);
begin
  s_b.SimpleText :=getLongHint(application.hint);
end;

I then used hints with a '|' prefix - like
HintText:='|Volume of crystals from total intersection area';

Such hints are correctly redirected from the hint field on simple controls (like check boxes), but not from TStringGrid.

Bart Broersma

2014-11-05 14:41

developer   ~0078916

Updated summary to reflect the problem.

Bart Broersma

2014-11-05 15:28

developer   ~0078918

Please test and close if OK.
Note: the hint in the hintwindow depends on the setting of CellHintPriority (amongst others).

Issue History

Date Modified Username Field Change
2014-10-28 01:24 mhiggins New Issue
2014-10-28 18:23 Bart Broersma Note Added: 0078705
2014-10-28 18:24 Bart Broersma LazTarget => -
2014-10-28 18:24 Bart Broersma Status new => feedback
2014-10-29 00:01 Bart Broersma Note Edited: 0078705 View Revisions
2014-10-30 03:08 mhiggins Note Added: 0078732
2014-10-30 03:08 mhiggins Status feedback => new
2014-11-03 13:24 Bart Broersma Note Added: 0078857
2014-11-03 13:24 Bart Broersma Assigned To => Bart Broersma
2014-11-03 13:24 Bart Broersma Status new => feedback
2014-11-03 13:25 Bart Broersma Note Edited: 0078857 View Revisions
2014-11-03 13:27 Bart Broersma Note Edited: 0078857 View Revisions
2014-11-05 02:07 mhiggins Note Added: 0078909
2014-11-05 02:07 mhiggins Status feedback => assigned
2014-11-05 14:41 Bart Broersma Note Added: 0078916
2014-11-05 14:41 Bart Broersma Summary Ongetcellhints not triggered in TStringGrid => TCustomGrid: Application.Hint not set when using CellHints
2014-11-05 15:28 Bart Broersma Fixed in Revision => r46760
2014-11-05 15:28 Bart Broersma Note Added: 0078918
2014-11-05 15:28 Bart Broersma Status assigned => resolved
2014-11-05 15:28 Bart Broersma Fixed in Version => 1.4
2014-11-05 15:28 Bart Broersma Resolution open => fixed
2014-11-05 15:28 Bart Broersma Target Version => 1.4