[comp.windows.news] Things that won't go away

zwicky@pterodactyl.cis.ohio-state.edu (Elizabeth D Zwicky) (04/04/89)

Recently I've been having a horrible time making things go away in 
NeWS. First it was a window, created from another window, with a
TextItem in it; it went away happily, unless the TextItem had
been activated. As soon as that cursor started blinking, the window
became immortal. After beating my head against that for a while, 
I simply cheated and unmapped the sucker in its /destroy. It still
doesn't die, but it's at least invisible.

Now, however, I have items that I am trying to make appear and
disappear. I used to do this by adding a canvas to the item that
was a child of the ItemCanvas, opaque, on top, and the same size,
and mapping and unmapping this canvas. This works but is inelegant
at best. It finally dawned upon me that I could just map and unmap
the ItemCanvas. Wrong. I can map and paint it, and it appears, but
after I unmap it it doesn't disappear until I repaint the parent
window. The parent window has 20-odd items in it, and repainting
it is unpleasant at best. The manual says a lot of things about
the conditions necessary for a canvas to appear, but nothing about
the conditions necessary for it to *dis*appear.

I can just make do with the various hacks I've evolved, but it
pains my aesthetic sense. Does anyone have any suggestions about
less horrible ways to get around these problems?

	Elizabeth (zwicky@cis.ohio-state.edu)

zwicky@pterodactyl.cis.ohio-state.edu (Elizabeth D Zwicky) (04/14/89)

Here are the proven fixes for my problems (by popular request):

The immortal window with the item in it (which is, indeed, the one
from wallpaper), can be made mortal by putting *anything* on the stack
before the "itemdict forkitems" (I am using "(Food for Randomness)").
Neither I nor Phillip Nicholson, who sent me this answer, has any idea
why. Although the immortality surely must be due to a remaining
reference (as many, many people suggested), I had no luck in finding
one, and cannot conjecture why this fix would cause one not to be
created.

The visible but unmapped items are a result of items being
transparent. Mapping and unmapping transparent items does not
propagate damage to the parent canvas. Making /Transparent false in
/ItemCanvas makes it work beautifully. This was also suggested by
several people.

Send me mail if you would like the fixed version of wallpaper; it
should function identically to the unaided eye, but it doesn't leave
things around using memory when it goes away.

	Elizabeth Zwicky (zwicky@cis.ohio-state.edu)

"Michael_Powers.Henr801M"@XEROX.COM (04/16/89)

Elizabeth writes
>Now, however, I have items that I am trying to make appear and
>disappear. I used to do this by adding a canvas to the item that
>was a child of the ItemCanvas, opaque, on top, and the same size,
>and mapping and unmapping this canvas. This works but is inelegant
>at best. It finally dawned upon me that I could just map and unmap
>the ItemCanvas. Wrong. I can map and paint it, and it appears, but
>after I unmap it it doesn't disappear until I repaint the parent
>window. The parent window has 20-odd items in it, and repainting
>it is unpleasant at best. The manual says a lot of things about
>the conditions necessary for a canvas to appear, but nothing about
>the conditions necessary for it to *dis*appear.

I didn't hear a response (unless someone answered directly) so, here's my
two cents. To solve the problem I simply changed the /Tranparent entry in
the ItemCanvas dictionary to "false". This makes the canvas opaque and will
fix what's underneath when the item is moved. (especially nice when things
are retained)  

Mike

powers.henr801m@xerox.com

zwicky@CIS.OHIO-STATE.EDU (Elizabeth D Zwicky) (04/16/89)

Actually, several people answered directly; later today I will post
the set of solutions. One person had actually fixed my code (from
a copy I had posted)! Making the ItemCanvas opaque did solve my
problem beautifully.

	EDZ