List Index Out of Bounds

Hi,


I got this error in the current version of TAdvStringGrid (7.0.0.0) and the previous version.  This error happens when I do the following.

Load list from DB (605 records)
Filter the list using NarrowDown (value was a 6 character string) from OnSearchEditChange
Delete a row from the filtered list.
Close the form.

In on FormClose, I have Grid.RemoveAllFilters which then triggered the error.

I traced the offending source line to AdvGrid.pas line 18680 in the function UnHideRowList.
Somehow, the variable "j" has become -1 and the List Index Out of Bounds error occurs.

I am using Delphi 2009 Enterprise on Windows 8 Professional.

Regards
Jeff


Sorry, the version for TAdvStringGrid is 7.2.0.0 and the version for TMS Component Pack is 7.0.0.0


/jeffc

Thanks for reporting. We traced & solved this issue. Next update will address this.

Hi Bruno,


I installed TMS Component Pack 7.0.1.0 and tested the TAdvStringGrid (7.2.1.0) with my problem. The listindex error does not show up but I think the changes has mixed up the grid rows slightly. After the call to RemoveFilters, I have missing data in random rows.

This is what I did to reproduce the error.

Load records from DB (622 records)
NarrowDown to 5 rows.
Close form.
In FormClose, call RemoveFilters and dump the contents of Grid to text file

Load records from DB (622 records)
NarrowDown to 5 rows.
Delete last row.
Close Form.
In FormClose, call RemoveFilters and dump the contents of Grid to text file.

Now compare the dump contents.
I have missing data in rows 15, 22, 32, 55, 383, 425, 434,444,616.

Furthermore, the 4 rows that satisfied the NarrowDown after the RemoveRows are no longer in the same
place ( I had the sql query sort alphabetically prior to loading to the grid) and the same  4 rows are repeated
at the end of the grid.

I can send you a copy of my dump files if you need.

Regards
jeffc



It is not supported to remove rows from a filtered grid. It can indeed cause erratic behavior. If you want to remove rows, please first undo the filtering, remove the row and then reapply the filtering.

Hi Bruno,


Is there a function then that will give me the unfiltered row number of the currently selected row so that I can remove the filter and delete the row and reapply the filter? RealRowIndex doesn't seem to work in this case.

Thanks!

Hi Bruno,


Did more testing on RealRowIndex. The first call to RealRowIndex after a NarrowDown will not return the correct value. Since I am reapplying the filter after the Delete, the second time around, RealRowIndex will then return the correct value.