[haiku-development] Re: Hello, and a BBitmap question.

  • From: "Rene Gollent" <anevilyak@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 7 Jun 2008 01:43:18 -0500

On Sat, Jun 7, 2008 at 1:34 AM, James Kim <jkim202@xxxxxxxxxxxxxxxxx> wrote:
> Thanks, but something else is causing trouble now. I wanted to delete
> all child views in the parent view and I have just noticed something.
> Methods such as BView::RemoveSelf(), BView::RemoveChild() does not seem
> to work on the parent view.
> For example, I tried counting the number of parent's children after
> removing each child from the parent view.
> printf("%d", fParent->CountChildren());
> for (int32 i = 0; i < fParent->CountChildren(); i++) {
>        RemoveChild(fParent->ChildAt(i)
>        printf("%d", fParent->CountChildren());
> }

Your loop does have one problem there...you're going to skip more or
less every other view while doing this. Also, you need to be calling
RemoveChild off fParent, not off your current view, it can't remove
what isn't attached to it.


while (fParent->CountChildren() > 0) {
printf("%d\n", fParent->CountChildren());



Other related posts: