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 » U++ Library : Other (not classified elsewhere) » Remove all children from TopWindow/ParentCtrl
Remove all children from TopWindow/ParentCtrl [message #60056] Mon, 24 July 2023 21:59 Go to next message
devilsclaw is currently offline  devilsclaw
Messages: 72
Registered: August 2022
Member
I tried something like this

void RemoveRecursivce(Upp::Ctrl *ctrl) {
  if(ctrl == NULL) {
    return;
  }
  for(Upp::Ctrl *_ctrl = ctrl->GetFirstChild(); _ctrl; _ctrl = ctrl->GetNext()) {
    RemoveRecursivce(_ctrl);
    if(_ctrl != NULL) {
      ctrl->RemoveChild(_ctrl);
    }
  }
}

[Updated on: Mon, 24 July 2023 22:02]

Report message to a moderator

Re: Remove all children from TopWindow/ParentCtrl [message #60057 is a reply to message #60056] Mon, 24 July 2023 22:10 Go to previous messageGo to next message
devilsclaw is currently offline  devilsclaw
Messages: 72
Registered: August 2022
Member
I also tried this, It seems to remove everything but the code to add it back in does not seem to work.

void RemoveRecursivce(Upp::Ctrl *ctrl) {
  if(ctrl == NULL) {
    return;
  }
  while(ctrl->GetChildCount()) {
    Upp::Ctrl *tctrl = ctrl->GetIndexChild(ctrl->GetChildCount() - 1);
    if(tctrl->GetChildCount()) {
      RemoveRecursivce(tctrl);
    } else {
      ctrl->RemoveChild(tctrl);
    }
  }
}
Re: Remove all children from TopWindow/ParentCtrl [message #60058 is a reply to message #60056] Mon, 24 July 2023 22:18 Go to previous message
devilsclaw is currently offline  devilsclaw
Messages: 72
Registered: August 2022
Member
If I do all of it manually. eg Call RemoveChild for each and every element in the UI it works fine. but trying to do it recursively seems to mess it up.

not sure what I am doing wrong.
Previous Topic: plugin/FT_fontsys, plugin/DroidFonts
Next Topic: StringUnZip example needed
Goto Forum:
  


Current Time: Fri May 03 22:09:55 CEST 2024

Total time taken to generate the page: 0.01725 seconds