• 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: How to implement an open dialog in a sheet and process its output?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to implement an open dialog in a sheet and process its output?


  • Subject: Re: How to implement an open dialog in a sheet and process its output?
  • From: Nathaniel Gottlieb-Graham <email@hidden>
  • Date: Mon, 12 Nov 2007 16:54:50 -0500

No, I know that the button is connected to the IBAction, because I put an NSLog() at the beginning of the method definition, and clicking on the button does indeed log the string to the console. While I was there, something I noticed the console producing was:
-[NSWindow window]: unrecognized selector sent to instance 0x12f180


I get no compiler errors or warnings. Is this because the selector is calling the filePanelDidEnd: method at runtime? So what's wrong with filePanelDidEnd:? The code I'm using is exactly as shown below.

Thanks again,
Nathaniel


- (IBAction)askForQuickTimeMovieSheet:(id)sender {

NSOpenPanel *panel = [NSOpenPanel openPanel];
NSArray *fileTypes = [NSArray arrayWithObjects:@"mov", @"mp4", @"avi", nil];

[panel beginSheetForDirectory:@"~Movies/"
file:nil
types:fileTypes
modalForWindow:[welcomeWindow window]
modalDelegate:self
didEndSelector:@selector(filePanelDidEnd:
returnCode:
contextInfo:)
contextInfo:nil];
}


-(void)filePanelDidEnd:(NSOpenPanel*)sheet
           returnCode:(int)returnCode
          contextInfo:(void*)contextInfo {
	// Do stuff here as soon as the sheet displays properly
}

Thanks again,
Nathaniel


Nathaniel,

I pasted your code into a sandpit project, and the sheet appears fine. Did you actually connect the button to the IBAction in Interface Builder? If you don't know how to do that, you should look for a tutorial on the web or at Apple's site.

Also, the sheet opens at the default Documents folder because the value of the first argument to the beginSheet... method is wrong. The tilde character is used by shells which expand it to the user's home directory. In a program (ie, not a shell), you'll need to pass a real path. Have a look in the docs for NSHomeDirectory() or NSString's -stringByExpandingTildeInPath method.

Ron


---------------------------------
Nathaniel Gottlieb-Graham
Mac specialist
email@hidden
techpaladin.com

_______________________________________________

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


  • Follow-Ups:
    • Re: How to implement an open dialog in a sheet and process its output?
      • From: Ron Fleckner <email@hidden>
References: 
 >How to implement an open dialog in a sheet and process its output? (From: Nathaniel Gottlieb-Graham <email@hidden>)
 >Re: How to implement an open dialog in a sheet and process its output? (From: Ron Fleckner <email@hidden>)
 >Re: How to implement an open dialog in a sheet and process its output? (From: Nathaniel Gottlieb-Graham <email@hidden>)
 >Re: How to implement an open dialog in a sheet and process its output? (From: Ron Fleckner <email@hidden>)

  • Prev by Date: Re: How to implement an open dialog in a sheet and process its output?
  • Next by Date: [Meeting] Toronto Area Cocoa and WebObjects Developer Group - November 13, 2007
  • Previous by thread: Re: How to implement an open dialog in a sheet and process its output?
  • Next by thread: Re: How to implement an open dialog in a sheet and process its output?
  • Index(es):
    • Date
    • Thread