TMSFMXGrid deleting and hiding rows


I need help understanding deleting and hiding rows. I'm using
Rad Studio Tokyo, c++, and UI Pack   I setup a test project
with a 5-column, 10-row grid.  The top row and left column are fixed.  I
enter 1 in row 1 (from 0), column 1 (from 0), 2 in the next row, etc.
so rows show 1-9.  One menu item does:


Another menu item does:


After hiding row 3, the rows are 1,2,4,5,6,8.9 which is what I expected:

After Grid->DeleteRow(2); Grid->UnHideRow(2); the rows are 1,4,5,6,7,8,9.  Rows 2 and 3 are both missing.

If I change the menu to


hiding row 3, deleting row 2 and unhiding row3 produces 1,4,4,5,6,7,8,9

assuming the the row parameter to DeleteRow(), HideRow() and
UnHideRow() are independent of row visibility.  I'm not sure how row
indexing is affected after deleting a row.  Is there something else I
need to do?  Thanks in advance.


The index that is passed to DeleteRow is regardless of the hide state. Please use RealToDisplRow to know the real index of column 2.

Thanks for the suggestion but it doesn't help.  I used Grid->RealToDisplRow () for all function parameters and got the same confusing results.

Please avoid deleting rows after rows are hidden. When a row is hidden, the row is removed and it remembers the position where it should be moved back when the row is unhidden. When you delete rows after hiding rows, this of course affects the position where the unhidden row will be moved back. 

We recommend to delete rows before hiding rows or as an alternative hide rows by setting their row height to  zero.

Setting row height to 0 instead of hiding rows works.  Thanks Bruno.