[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: removing subviews from a window
- To: email@example.com (Martin Stanley)
- Subject: Re: removing subviews from a window
- From: firstname.lastname@example.org (Bill St. Clair)
- Date: Thu, 19 Mar 1992 09:52:34 -0500
- Cc: info-mcl
>I am trying to re-use a window that has quite a few subviews. Perhaps the
>source of my troubles is that two of these views are scrolling views and
>gave associated scrollers, etc. What I am trying to do is to remove the
>subviews first and then add my new versions of the subviews. I have tried
>various methods: remove-subviews to remove them all at once, map-subviews
>to remove one at a time, and I have surrounded the calls with
>without-interrupts (I'm not sure why, but I was getting desperate!).
>What happens is that an error is returned that one of the subviews is not
>a subview of my original window. But it was before I tried to remove it!
>The act of removing one or more of the previously (and the ordering is
>determined by the functions I used to get the subviews) removed subviews
>has somehow caused the subview to become disconnected from its container!
>Is the order of removal signifcant?
>Am I missing something more basic?
>I finally gave up and simply close the window and open a new identical one
>with the new subviews. Of course, I would prefer my intended approach.
>Any help would be appreciated. (I can supply more specific detail if
>necessary, of course.)
The scrollers are probably your problem. When you create a scroller,
it's initialize-instance method creates 0-2 scroll bars plus, optionally,
a BOX-DIALOG-ITEM. Whenever SET-VIEW-CONTAINER is called on a scroller,
it moves the scroll bars and outline box to go with it.
REMOVE-SUBVIEWS errors if any of the subviews given to it are not
subviews of the specified view. Hence, the following code will
cause signal an error if one of the subviews is a scroller:
(apply #'remove-subviews window (view-subviews window))
Instead, try the following:
(do-subviews (sv window)
(set-view-container sv nil))
Bill St. Clair