OnGetCellColor of TAdvStringGrid: AState very often has empty array

Is this normal behavior of the OnGetCellColor event?

When the event fires on hovering over a cell with the mouse the AState has an empty array.
When the event fires sometimes the col and/or row are negative.

Please send reply to paul.sinnema@wur.nl

  1. When the cell is in normal state, it is by design that AState is an empty set
  2. Under what exact circumstances do you see the col/row params negative?

That is exactly the point. It only happens intermittent. We got an error report that the application crashes with this error There are 6000+ users of this application but the problem only arises on very few occasions. So telling you when it happens is near to impossible. I've tried to investigate the problem very often but never got any clue on when it happens. B.t.w. it only seems to happen on a hover over the cell. Hope that helps.

Shouldn't the AState have 'gdHotTracking' when the mouse is over the cell without a click?

Please send a reply to: paul.sinnema@wur.nl instead of the user for the account. The account is registered to a financial person that does no development.

Regards,
Paul

The event OnGetCellColor is triggered for drawing of the cell in all states, also in normal state, i.e. when state = [].

A possible way to trace where this is coming from is add code in OnGetCellColor to check for ACol, ARow, raise an exception when this condition happens and then use a stack trace tool like Eurekalog or madexcept to send the stack trace.

I was able to get negative values. Here's a screen print of that moment and a screenprint of the stack.


Here are screenshots of that exact moment in the source of AdvStringGrid.




It seems to happen when the mouse is just touching the edge of a cell. When it's in the cell the values do not become negative. You will probably notice this only very few times because of the timer delay involved.

Here's a screen capture video of the moment it happens.

2022-06-02_15-40-13.zip (1.4 MB)

Do you have an event handler for OnGridHint? Other event handlers that might interfere?
It is by design that OnGridHint can be triggered with ACol and ARow having values -1,-1 as the mouse can be in an area where there is no cell.