TMSFMXGrid deleting and hiding rows

Hi,

I need help understanding deleting and hiding rows. I'm using
Rad Studio Tokyo, c++, and UI Pack 3.6.6.0.   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:

Grid->HideRow(3);

Another menu item does:

Grid->DeleteRow(2);
Grid->UnHideRow(2);

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

Grid->DeleteRow(2);
Grid->UnHideRow(3);

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

I'm
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.


Hi, 


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.