• 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: Ron Fleckner <email@hidden>
  • Date: Tue, 13 Nov 2007 08:27:16 +1100


On 13/11/2007, at 6:30 AM, Nathaniel Gottlieb-Graham wrote:

Thanks Ron, that was a great help. I now have the following code in the .m file, but nothing happens when the button I've wired up to this is clicked on. I know the method is getting called, but the sheet never appears.


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

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: Nathaniel Gottlieb-Graham <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>)

  • Prev by Date: Re: Resolution independent cursor
  • Next by Date: Re: How to implement an open dialog in a sheet and process its output?
  • 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