TAdvStringGrid - OnGridHint

Though the release notes state a fix for calling OnGridHint though the mouse is not over a cell, it still seems to be an issue. I'm getting error reports with ACol or ARow = -1 (can't tell which from the log thought). The problem appeared for me in 10.6.1.0. I just updated to today's 10.6.2.0, so maybe it is already fixed -- but the release notes don't include another fix for the problem. So I guess it might be still an issue.

Could you look into it?

Thank you!

What exactly is the issue?
It is by design that when the mouse is not over a cell, OnGridHint will be triggered with ACol = -1 and ARow = -1. This way, you can have a different hint for cells as for the area without cells.

Test on a default grid:

procedure TForm1.AdvStringGrid1GridHint(Sender: TObject; ARow, ACol: Integer;
  var hintstr: string);
begin
  if (ARow = -1) or (ACol = -1) then
    hintstr := 'mouse not over cell'
  else
    hintstr := 'mouse over cell '+ACol.ToString+':'+ARow.ToString;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  advstringgrid1.ShowHint := true;
end;

Thanks for the reply!

Is this new behaviour? I'm getting lots of error reports from people in relation to this behaviour, so I was wondering why this happens just now and the release notes recently mentioned something ...

I can work around the behaviour, but I thought this might have been unintentional ... looks like it's not, right?

We fixed this behavior as users wanted a way to detect whether the mouse was over cells or just over the grid background. As such, make sure to check for -1 values instead of directly using the ACol,ARow parameters to access cells.