Re: Hiding a view
Re: Hiding a view
- Subject: Re: Hiding a view
- From: email@hidden
- Date: Thu, 25 Oct 2001 11:36:09 -0400
changing the position of the view will hide it from your eyes, but it
will still be in the responder chain, probably not what you want,
right ? if it's a textfield, and accept key event, you will have to
handle it as well. And if it's a button that accept key shortcut, then
again you have to work around.
Any solution that is not to remove from superview (and the responder
chain) is un my mind weak in one way or the other.
Maybe if you tried to remove from superview, we could help you to solve
the side-effects problem that this solution have. Move and resizing
come to mind, and I would try to solve it by swaping the view with a
NSView instance that have the same resize attributes, so when you unhide
it, you swap back your view and give the nsview instance's size.
good luck,
- jfv
Jean-Frangois Veillette
Sherbrooke (Quibec)
Le Jeudi 25 octobre 2001, ` 11:07 , Rainer Brockerhoff a icrit :
From: Ondra Cada <email@hidden>
Date: Thu, 25 Oct 2001 11:45:41 +0100
Dustin Mierau (DM) wrote at Thu, 25 Oct 2001 00:17:15 -0700:
DM> This is probably a stupid question, how do I hide a subview? I
DM> can't actually find a method to "hide" an NSVIew.
Move it well outside its superview (eg. set its origina to
[100000,origy] or so).
Moving up and/or to the left seems to be better... moving down or to
the right as in your example apparently may move the view when the
window is resized... be prepared to recalculate the view's origin to
move it back, and not depend on where it was or on where you left it.
I couldn't find this caveat in TFM, BTW :-)
A somewhat inelegant alternative is to group one or several views into
a superview, and set the size of the superview to 0 by 0. The subviews
will be clipped while drawing.
-- Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"Originality is the art of concealing your sources."
http://www.brockerhoff.net/ (updated Oct. 2001)
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev