Board index » cppbuilder » TreeNodes->Clear() doesn't work in destructor of form
Russell Hin
![]() CBuilder Developer |
Mon, 10 Feb 2003 03:00:00 GMT
TreeNodes->Clear() doesn't work in destructor of form
I have created a new app (in BCB5 patch 1) and added
__fastcall TForm1::TForm1(TComponent* Owner) Quote} { TreeView1->Items->Add(NULL, "Hello"); int i = TreeView1->Items->Count; TreeView1->Items->Clear(); int j = TreeView1->Items->Count; Quote} After the constructor, i = 1 and j = 0 as expected. But at the end of the destructor, i = 1 and j = 1. The clear hasn't worked. Is it supposed to behave in this way? It seems like a bug to me. Any ideas? I know I don't have to do this in the destructor, but I have a general clean At the moment I've had to perform a loop to delete the tree nodes: while (TreeView1->Items->Count) Quote} stepping in to the source code, but it just skips over that line. (I do have the proffesional version, and I can usually step in to the source). Russell -- |