Re: re Hiding controls and another question
Re: re Hiding controls and another question
- Subject: Re: re Hiding controls and another question
- From: Dennis De Mars <email@hidden>
- Date: Fri, 1 Mar 2002 07:42:54 -0800
The topic is often described as "hiding NSViews" so you might want to
search on that, or simply on "hiding." I can assure you that the topic
came up at least twice in the past month.
I agree there should be a facility to make controls, or NSViews in
general, invisible. Since many people seem to expect this feature, and
pretty much every other GUI framework I've ever seen has it, I think
Apple should just add it in a future update. (As you can see, some other
people feel differently, but they don't have to use it). Until that
happens, if ever, I have a few comments for you:
1) You've posted two or three messages on the subject, which I guess is
OK if you like to argue about this but it probably won't result in Apple
doing anything about it, because they have enough work to do already
without scouring the mailing list for new things to do. Somebody could
file a bug report/request directly to Apple and maybe they would
actually do it then.
2) The way this was apparently intended to be handled is, you would
simply remove the control from the view is displayed in, but save a
reference to it. (Make sure to retain it first). Then stick it back in
the view when you want to make it visible again. This is not as simple
as a hide command, but actually it is still pretty simple, and works for
most cases. For NSViews in general, there are a couple of objections to
this method in some cases:
- If the NSView you are hiding is supposed to track resizing of the
window, that won't happen during the period the NSView is removed from
its superview.
- The NSView loses its place in the ordering of subviews (I think this
only matters if the subviews overlap, and the guys who tell you that you
shouldn't hide controls will also tell you you shouldn't do that).
- If it's a text box, you have to deal with restoring the tab ordering.
If you look at the recent discussion, there are some workarounds for
these cases. It may well be that none of these apply to your case, in
which case you can just remove and reinsert the controls.
3) Do a search of the OS X Dev omnigroup mailing list archives also.
This topic has come up periodically for years, and I think a year or two
ago someone outlined a category you could add to NSView to get the
show/hide capability. I don't know if the suggestion actually worked or
not, I didn't try it, but I think it involved leaving the NSView in
place and short-circuiting drawing somehow, so it got around the
objections mentioned above.
4) Although I consider the absence of show/hide an omission, it is one
of the very few omissions I have encountered in using Cocoa. I can see
how, if you encountered this on your first day of using Cocoa, you might
be thinking "gee, if something this basic is missing, what else is
missing?" But don't worry, this is an anomaly and not typical of Cocoa;
in fact Cocoa is generally much more complete than most frameworks.
- Dennis D.
On Thursday, February 28, 2002, at 11:14 PM, John Pattenden wrote:
First I should say I searched my mailbox which has about 1700 cocoa
list messages in it, and did not find this topic.. that said I'll take
you word for it that the topic has come up before.
The argument that we should not be able hide controls show a distinct
lack of imagination. In my case I generate UI based on some settings
such as if there is sound. If not then I hide things like a mute
button. Disabling it only confuses users. The argument that we should
not be able to hide controls because it always bad is specious to say
the least...
The other argument that it is very sophisticated and object oriented
also seems pretty bizarre to me "the you're not sophisticated enough"
argument is pretty amusing.. How about I pass my control object a
message to hide itself.. how object oriented would that be??? I think
there may be a tad of Cocoa defence going on here..
I'm enjoying Cocoa and perhaps the fact that it simplifies so many
things makes all the more surprising when seemingly simple
functionality is not available...
John Pattenden
ScreenTime Media
http://www.screentime.com
_______________________________________________
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.
_______________________________________________
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.