Re: [Q] SavePanel NSFileHandlingPanelCancelButton
Re: [Q] SavePanel NSFileHandlingPanelCancelButton
- Subject: Re: [Q] SavePanel NSFileHandlingPanelCancelButton
- From: Mark de Jong <email@hidden>
- Date: Sun, 16 Jun 2002 18:41:19 -0700
Andy,
This works perfectly. Thank you very much!
-- Mark
On Sunday, June 16, 2002, at 09:30 AM, Andy Lee wrote:
-----NSView_Utils.h-----
#import <Cocoa/Cocoa.h>
@interface NSView (Utils)
- (id)viewOfClass:(Class)aClass withTag:(int)tag;
- (id)buttonWithTag:(int)tag;
@end
-----end NSView_Utils.h-----
-----NSView_Utils.m-----
#import "NSView_Utils.h"
@implementation NSView (Utils)
- (id)viewOfClass:(Class)aClass withTag:(int)tag
{
NSEnumerator* e;
NSView* aSubview;
NSView* result;
if (([self tag] == tag) && [self isKindOfClass:aClass])
return self;
e = [[self subviews] objectEnumerator];
while ((aSubview = [e nextObject]))
if ((result = [aSubview viewOfClass:aClass withTag:tag]))
return result;
return nil;
}
- (id)buttonWithTag:(int)tag
{
return [self viewOfClass:[NSButton class] withTag:tag];
}
@end
-----end NSView_Utils.m-----
-----test code-----
NSSavePanel *panel = [NSSavePanel savePanel];
NSButton* cancelButton =
[[panel contentView]
buttonWithTag:NSFileHandlingPanelCancelButton];
NSLog([cancelButton title]);
-----end test code-----
_______________________________________________
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.