Exception in grids.pas in TCustomGrid.ResetHotCell. Bug in TCustomGrid.Clear?
Original Reporter info from Mantis: Slawek
-
Reporter name: Sławomir Załęcki
Original Reporter info from Mantis: Slawek
- Reporter name: Sławomir Załęcki
Description:
My application (in the context menu) saves the grid to a file and reads the grid from file. When I read the data from the grid I use the following code:
Columns.Clear;
Clear;
LoadFromFile(fname);
The second time ever I get an error when you move the mouse.
My project raised exception class 'EListError' with message: List index (-1) out of bounds
Additional information:
I was looking for a long time causes.
In my opinion bug is in procedure TCustomGrid.Clear;
in this procedure is:
FGCache.HotCell := Point(-1, -1);
should be:
FGCache.HotCellPainted := false;
FGCache.HotCell := Point(-1, -1);
or better:
FGCache.HotCellPainted := false;
ResetHotCell;
Details:
Then only FGCache.HotCell := Point(-1, -1) then sometimes value FGCache.HotCellPainted remains true.
Next if will be called HeadersMouseMove
and next
if (gz<>HotGridZone) or (P.x<>HotCell.x) or (P.y<>HotCell.y) then begin
ResetHotCell; //in HeadersMouseMove
and next
if HotCellPainted then //HotCellPainted is true(!) and HotCell = (-1,-1)
InvalidateCell(HotCell.X, HotCell.Y);
and next
R:=CellRect(aCol, aRow); //in InvalidateCell (aCol, aRow = -1 (!))
and next
ColRowToOffset(True, True, ACol, Result.Left, Result.Right); //in CellRect
and next
StartPos:=integer(PtrUInt(AccumWidth[index])); //in ColRowToOffset; index = -1
then
raised exception class 'EListError'
Mantis conversion info:
- Mantis ID: 17426
- Version: 0.9.28.3 (SVN)
- Fixed in version: 0.9.29 (SVN)
- Fixed in revision: 27387 (#6c402161)
- Target version: 0.9.30