Enabling/Disabling Control view hiearchies
Enabling/Disabling Control view hiearchies
- Subject: Enabling/Disabling Control view hiearchies
- From: Scott Thompson <email@hidden>
- Date: Fri, 18 Jun 2004 16:15:13 -0500
I'm trying to set up a scheme whereby I can enable and disable a group
of related controls all at once. Under most of the application
frameworks that I am more familiar with (Carbon/HIView, PowerPlant,
etc...) one can set up a view hierarchy of controls and then
enable/disable the parent view to change the enabled state of the
children. Most are clever enough that when you reenable the parent
view, if any of the children were enabled before the parent was
disabled, then those "latently enabled" controls will be enabled again.
If I'm reading things properly, however, Cocoa distinguishes itself
from those other frameworks in that NSView doesn't have the concept of
being enabled. You don't see enabling behavior in the hierarchy until
you get to NSControl.
This, however, begs the question of how to group controls so that they
enable or disable together (i.e. if I turn on this checkbox then I
enable all the controls related to it).
As far as I can tell, you have to do something like maintain IB outlets
that point to the controls (including static text labels) and then
enable/disable them one-by-one.
I thought to group the controls inside of an NSBox that had no border,
but NSBox doesn't seem to understand enabling or disabling itself (and
it's subviews) either.
Given the elegance of the rest of the framework, I can only think that
I must have misunderstood something. Can anyone help me out by
describing the expected strategy for enabling/disabling controls, or by
pointing me to the appropriate documentation?
Scott
_______________________________________________
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.