Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TreeCtrl » Node id calculation after removal ?
Node id calculation after removal ? [message #41884] Mon, 03 February 2014 17:17 Go to next message
Runik is currently offline  Runik
Messages: 5
Registered: February 2013
Location: France
Promising Member
Hello,

Is there a way to have node ids recalculated after a node removal ?
Currently the removed node stays in the treecontrol in an undefined state, and the following node ids in the hierarchy aren't modified, leading to parent id trouble when you save treecontrol data to a file and load it back ...

I suppose it's performance related, but is there a way to overcome this ?

Thanks Smile

Edit: maybe it'll be clearer with a little schema :

Original treecontrol :
root         // id=0
|-node1      // id=1, parent id=0
|  |-node1.1 // id=2, parent id=1
|-node2      // id=3, parent id=0
|  |-node2.2 // id=4, parent id=3


After removal of node1.1 :
root         // id=0
|-node1      // id=1, parent id=0
|-node2      // id=3, parent id=0
|  |-node2.2 // id=4, parent id=3


After saving to a file and reloading
root         // id=0
|-node1      // id=1, parent id=0
|-node2      // id=2, parent id=0
|  |-node2.2 // id=3, parent id=3 // ASSERT triggered !

[Updated on: Mon, 03 February 2014 17:25]

Report message to a moderator

Re: Node id calculation after removal ? [message #42034 is a reply to message #41884] Wed, 12 February 2014 18:43 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, no, after removing node, you should consider its id invalid.

In fact, you should not count on any properties of id other than that it is unique for TreeCtrl and valid since node creation till its removal. Nothing else is guaranteed.
Previous Topic: SetFocus with EditString as Node
Next Topic: [solved] Can we get the private members of TreeCtrl made protected?
Goto Forum:
  


Current Time: Fri Mar 29 13:30:29 CET 2024

Total time taken to generate the page: 0.01886 seconds