TMSFNCGrid Hide/Unhide Row Issue

I think the code is fundamentally wrong when using hidden rows, because you are initially adding a pointer to an object, but when inserting rows the pointer to the object is not correct anymore. hidden rows are handled differently internally and therefore do not count when removing and inserting rows. When further finetuning the code for this particular case, I only see issues rising when applying this in other cases. To workaround this complex structure I suggest to collapse rows using a rowheight of 0 instead. Alternatively, If you want to build a tree view, perhaps you could consider using our multi-column treeview instead.