Re: Hiding a view
Re: Hiding a view
- Subject: Re: Hiding a view
- From: Simon Stapleton <email@hidden>
- Date: Thu, 25 Oct 2001 16:16:02 +0100 (BST)
>
From: rsharp <email@hidden>
>
To: Ondra Cada <email@hidden>
>
cc: Dustin Mierau <email@hidden>, email@hidden
>
Subject: Re: Hiding a view
>
>
On Thu, 25 Oct 2001, Ondra Cada wrote:
>
>
> Dustin,
>
>
>
> >>>>>> 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).
>
>
Are you serious? And what happens if you have "geometry management"
>
where
>
other objects are posistioned relative to that subview?
>
>
If Cocoa doesn't have a Show/Hide API then it really should. We
still
>
have to use this lame framework (Zinc) at my day job and it too
>
doesn't
>
have Show/Hide. You thus have to move stuff offscreen, but not if
it
>
has
>
geometry management...if it does, there's no way to hide it as when
>
you
>
move something offscreen, some sibling items go offscreen too.
>
>
Visibility and position should _not_ be dependent upon each other.
>
>
Rick Sharp
Well, assuming you don't want to remove the view from its superview,
you don't have a whole lot of choice.
A hypothetical 'hide' selector (or, more likely a -(BOOL)shouldDraw
selector) will not remove the view from the view hierarchy. Thusly,
your view, although not visible, could well be sucking up events and
processing them, silently, without your user understanding why.
Having been bitten a few times by transparent UI items, I would
strongly urge you to remove the view from the superview.
NSView does more than just drawing.
Simon
--
PGP Key ID : 0x50D0698D
--
If the answer isn\'t obvious, the question is a distraction. Go find
an easier question.