TTreeView / AddNodeObject problem - deletion and additional addition called (BCB6)


2004-06-21 07:11:21 PM
cppbuilder33
I created own component derived from TCustomTreeView. Each node contains
data derived from my class TTNData.
The problem occurs when I create nodes; it looks as follows:
1) I create nodes using code below (first level of the tree):
Items->AddNode (NULL, NULL, d->TreeText, d, naAdd);
where d is data object (containg text to be displayed in field TreeText). I
do it several times (for all DB entries).
2) I checked that addition function for iserted nodes is called - and as for
now it looks ok.
3) Suddenly - after creating - CustomTreeView deletes all nodes and inserts
its again (Deletion and Addition events are called). I don't have any idea
why this happens; its problem for me, because i wanted (very much :) to make
delete my data in OnDeletion event - and its quite hard to make loading data
on OnAddition event.
It happens only for first level of tree; i tried to make inserting in way
like this:
TTreeNode * last = this->Items->GetFirstNode();
d->FTreeNode = this->Items->AddNode (NULL, last, d->TreeText, d, naAdd);
but it doesn't help.
For next levels, code:
Items->AddChildObject (Node, (*it)->TreeText, (*it));
works very good.
It worked ok in BCB5; problems occurs in BCB6.
I would apreciatie for any help