• 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: [Q] SavePanel NSFileHandlingPanelCancelButton
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] SavePanel NSFileHandlingPanelCancelButton


  • Subject: Re: [Q] SavePanel NSFileHandlingPanelCancelButton
  • From: Andy Lee <email@hidden>
  • Date: Sun, 16 Jun 2002 12:30:55 -0400

At 12:14 PM -0400 6/16/02, Andy Lee wrote:
Disclaimer: I haven't compiled any of the above.


Okay, FWIW I quickly tried my code and it found the Cancel button successfully (and the Save button when I tried that). Feel free to use if this helps or ignore if not:

-----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-----

--Andy
_______________________________________________
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.

  • Follow-Ups:
    • Re: [Q] SavePanel NSFileHandlingPanelCancelButton
      • From: Mark de Jong <email@hidden>
References: 
 >Re: [Q] SavePanel NSFileHandlingPanelCancelButton (From: Matt Neuburg <email@hidden>)
 >Re: [Q] SavePanel NSFileHandlingPanelCancelButton (From: Andy Lee <email@hidden>)

  • Prev by Date: Re: [Q] SavePanel NSFileHandlingPanelCancelButton
  • Next by Date: newbie: sending actions between files
  • Previous by thread: Re: [Q] SavePanel NSFileHandlingPanelCancelButton
  • Next by thread: Re: [Q] SavePanel NSFileHandlingPanelCancelButton
  • Index(es):
    • Date
    • Thread