FNCTreeView adding virtual node

Hello,

I have a TreeView implementing virtual nodes.  Mostly it is working well.  There is one case I can't get right and wonder if it is a bug, or something I am doing wrongly.

The tree view has levels 0,1,2.

If I have a tree expanded like this

Root
    - item 1
        item 11
        item 12
    - item 2
       item 21
       item 22

I then add item 13, inserting an element into the items for the tree, and inserting a virtual node.

The display is then corrupted and looks like this

Root
    - item 1
        item 11
        item 12
        item 13
    + item 2
       item 21
       item 22

Item 2 is still showing its expanded items, but the treeview thinks the row is collapsed.  Expanding the item again gives a corrupted display.  The only way I have found to recover is to refresh the display.

If there are any branches of the tree that are expanded after the position of the insert, they are all corrupted in this manner.

Is there something I should be doing to prevent this corruption ?

TIA,
Sue
    

Can you please inform what exact code you use to  reproduce this?

I have sent a small demo project to support.

Sue

We did follow up via email.

For anyone interested in this in the future, the problem was my understanding of how the Treeview works in virtual mode.

I was attempting to build up a treeview as nodes were expanded by adding virtual nodes in the BeforeExpandNode event.  This is something that cannot be done.  It is possible to add nodes to the collection in this event.  By reworking my code to use collection mode instead of virtual mode, I have the treeview working as I wanted.

Thanks again to TMS for their excellent support.

Sue