Re: Associate, NSView in main window, and disable objects on panel
Re: Associate, NSView in main window, and disable objects on panel
- Subject: Re: Associate, NSView in main window, and disable objects on panel
- From: Daniel Staal <email@hidden>
- Date: Sun, 05 Aug 2007 16:40:44 -0400
--As of August 5, 2007 1:34:59 AM +0200, Claus Atzenbeck is alleged to have
said:
(3) Is there a single command to disable all buttons, text fields, etc.
of an NSPanel?
--As for the rest, it is mine.
Not as such. I had a similar problem a while back and was given this code
for a protocol:
===========================================
@interface NSView (MYDisablingProtocol)
- (void)recursivelyDisableSubviews;
- (void)recursivelyEnableSubviews;
@end
@implementation NSView (MYDisablingProtocol)
-(void)recursivelyEnableSubviews {
if ([self respondsToSelector:@selector(setEnabled:)]) {
[self setEnabled:YES];
[[self subviews]
makeObjectsPerformSelector:@selector(recursivelyEnableSubviews)];
}
else {
[[self subviews]
makeObjectsPerformSelector:@selector(recursivelyEnableSubviews)];
}
}
-(void)recursivelyDisableSubviews {
if ([self respondsToSelector:@selector(setEnabled:)]) {
[self setEnabled:NO];
[[self subviews]
makeObjectsPerformSelector:@selector(recursivelyDisableSubviews)];
}
else {
[[self subviews]
makeObjectsPerformSelector:@selector(recursivelyDisableSubviews)];
}
}
@end
===========================================
Note that the above doesn't work on NSTableViews: They don't disable.
(This does disable their surrounding scrollview though.) Something similar
would probably be useful for you.
Daniel T. Staal
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden