Re: setEnabled on a NSView
Re: setEnabled on a NSView
- Subject: Re: setEnabled on a NSView
- From: David Remahl <email@hidden>
- Date: Fri, 22 Feb 2002 01:25:06 +0100
Personally I created a category on NSView to solve this issue. It goes
something like this, and seems to work just fine:
//
// NSView-DisableSubsAdditions.m
// Can Combine Icons
//
// Created by David Remahl on Tue Dec 25 2001.
// Copyright (c) 2001 Infinity-to-the-Power-of-Infinity. All rights
reserved.
//
#import "NSView-DisableSubsAdditions.h"
@implementation NSView(DisableSubsAdditions)
- (void)disableSubViews
{
[self setSubViewsEnabled:NO];
}
- (void)enableSubViews
{
[self setSubViewsEnabled:YES];
}
- (void)setSubViewsEnabled:(BOOL)enabled
{
NSView* currentView = NULL;
NSEnumerator* viewEnumerator = [[self subviews] objectEnumerator];
while( currentView = [viewEnumerator nextObject] )
{
if( [currentView respondsToSelector:@selector(setEnabled:)] )
{
[(NSControl*)currentView setEnabled:enabled];
}
[currentView setSubViewsEnabled:enabled];
[currentView display];
}
}
@end
/ Sincerely, David
>
with NSControl, one can use "setEnabled:" to enable and disable it's UI
>
element easily. Is there a one step procedure to disables all the controls
>
within a custom NSView?
>
>
jake
_______________________________________________
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.