• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: setEnabled on a NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >setEnabled on a NSView (From: Jake <email@hidden>)

  • Prev by Date: setEnabled on a NSView
  • Next by Date: Re: Dockling Menu Questions
  • Previous by thread: setEnabled on a NSView
  • Next by thread: Cocoa newbie - document-based Cocoa app with OpenGL
  • Index(es):
    • Date
    • Thread