Jump to content


Photo

Delete Top-Level Selected Node and all Children

Delete Children

  • Please log in to reply
2 replies to this topic

#1 dougwinsby

dougwinsby
  • Members
  • 2 posts

Posted 22 May 2019 - 05:13 AM

 I was trying to delete a "selected" top-level node along with all its children (from code).
 
I first tried: 

props.SelectedNode.ClearChildren;
But that only deleted some of the children (and of course, not the selected node).
 
I tried these two other methods, but without success:

props.Nodes.ClearChildren(oNode);
propsPriceSheet.Nodes.Delete(0);

If finally tried something like the following, which worked, but seems more difficult than it should be:


oParent := props.SelectedNode;
for i:= pred(props.Nodes.Count) downto 0 do
begin
  oNode := props.Nodes[i];
  if oNode.ParentNode = oParent then oNode.Free;
end;
oParent.Free;

Am I missing a better way?

 



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 22 May 2019 - 11:39 PM

Hi,

 

It seems that this is a bug. Free should destroy them all. I will work now on quick fix and send you updated code.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 27 June 2019 - 01:32 PM

Hi,

 

I hope that I have fixed the bug in latest release. You can download update now.

 

Thank you for your report.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.





4 user(s) are reading this topic

0 members, 4 guests, 0 anonymous users