currently I am fighting with wxTreeCtrl. All I want to do is adding and removing items. Therefore I first stored the itemids in a list (from irrlicht), but when casting the iterator to an id and calling tree->Delete(id) nothing happend. So then I wrote a container class with only one wxTreeItemId attribute. Storing them into a list and using their ->getID() should work. But, well, it causes the strangest things to happen. Sometimes it does what it should and deletes the items from the tree, sometimes it just does nothing and sometimes it removes objects from the gui that do not even belong to the tree
To determine the Item to delete:
Code: Select all
for(core::list<CTreeItemStorage*>::Iterator it_store = id_list.begin();it_store!=id_list.end();it_store++){
CTreeItemStorage *tmpStore = (*it_store);
wxTreeItemId tmpID = tmpStore->getID();
scene::ISceneNode *tempnode = (scene::ISceneNode*)treeCtrl_ObjectManager->GetItemData(tmpID);
if(tempnode == node){
id_list.erase(it_store);
treeCtrl_ObjectManager->Delete(tmpID);
break;
}
}
Code: Select all
id_list.push_back(new CTreeItemStorage(treeCtrl_ObjectManager->AppendItem(treeItemTrack,wxString(name,wxConvUTF8),-1,-1,(wxTreeItemData*)tmpnode)));
I am using wxWidgets 2.8.10 on Win XP Sp3.
greetings