Re: The best way to hide views.
Re: The best way to hide views.
- Subject: Re: The best way to hide views.
- From: Brant Vasilieff <email@hidden>
- Date: Fri, 21 Mar 2003 14:54:32 -0800
There are a few.
1) remove and add the view. For resizable views many resort to placing
the items they wish to make visible/invisible within a NSBox. Then
when they need to reinsert the view, it can be resized to match the
boxes size.
2) Use a NSTabView as John suggests.
3) Move the location of the object beyond the bounds its parent's
frame. This doesn't handle resizing as well, but is very easy to
encode as a category on NSView.
I've written a class which works similar to method 1, yet doesn't
pollute your interface by requiring your to nest the items inside of a
NSBox. It stores the parent view, and it's size, so when it goes to
reinsert a view it can adjust to any resizes that may have happened
since it was removed. To use it, drag the header file to your nib file
in IB. Then instantiate a copy of the VViewCloak. Make a connection
from the cloak to the view you want it to be able to hide. It responds
to hide, show, and toggle actions.
If you want to download it, it's located in my iDisk.
homepage.mac.com/brantv/
File Sharing
viewCloak.tar
Hope that helps,
Brant
On Thursday, March 20, 2003, at 10:00 PM,
email@hidden wrote:
I am wondering what the best way to hide views is. I currently need an
NSSplitView to not display itself, but am finding it quite difficult.
I tried to have a _isVisible member variable and then rewrite display
to only display if _isVisible was set to true:
- (void)display
{
if(_isVisible) [super display];
}
But this does not work since NSSplitView does not call display, nor
displayRect, nor all the other displays nor drawRect! I am finding it
quite difficult to hide this view.
Does anybody have any good ideas that do not involve moving it outside
the viewing area of the window? (the view is being
repositioned/resized as its hidden so the move away solution would not
be the best).
The canonical way to do this is to remove the view in question from the
view hierarchy. You might also look into putting your splitview inside
a tabview that has its tabs hidden.
_______________________________________________
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.