Re: Maintaining Z-Order while hiding NSViews
Re: Maintaining Z-Order while hiding NSViews
- Subject: Re: Maintaining Z-Order while hiding NSViews
- From: David Elliott <email@hidden>
- Date: Wed, 20 Aug 2003 10:24:42 -0400
NOTE: Sorry publiclook for replying to you personally and forgetting
about this list. I'm too used to the wxWindows mailing lists now which
set Reply-To which I don't agree with but have become accustomed to.
On Tuesday, August 19, 2003, at 11:36 PM, publiclook wrote:
I suggested using a category and dictionary to maintain isVisible
flags for any view including all of the Cocoa controls. If you don't
need to hide any view, you can do all of the things I suggested in a
subclass of NSView and use the subclass when appropriate. Finally,
there are lots of good reasons not to hide views that have been
discussed in this forum.
After sending you a mail indicating I was going to try the NSZeroRect
thing, I've decided against that. Basically, I read the archives of
this list and saw that sizing would be a major concern. That was, in
fact, the reason I went with a dummy view that maintained the same size
as the hidden view. In fact it calls setFrame: on the hidden NSView
whenever it receives a frame changed notification and it is initialized
with the current frame of the view to be hidden as well as its
autoresizing mask.
In other words, I still like the idea of using a dummy view to fully
stand in for the hidden view. It makes the code a lot simpler since I
still get the usual resizing behavior.
What solved my crash was your suggestion to override hitTest: to return
nil. By doing so the superview avoids sending mouse events to it which
therefore don't need to be forwarded back to the superview where the
dummy view might get deleted and cause a crash because it's within a
mouse event handler.
Since I'm still using the dummy view concept then I assume I don't have
to worry about the display(InRect:) stuff because drawRect will draw
nothing anyway. The only advantage I could see is that overriding
those would avoid setting up a graphics context at all which might be
good for performance reasons.
Thanks again for the hitTest: suggestion. That seemed to be exactly
what was needed!
-Dave
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.