Re: NSOpenPanel -runModalForDirectory:file:types: won't select file
Re: NSOpenPanel -runModalForDirectory:file:types: won't select file
- Subject: Re: NSOpenPanel -runModalForDirectory:file:types: won't select file
- From: Roland Torres <email@hidden>
- Date: Fri, 20 Apr 2007 09:34:40 -0700
On Apr 20, 2007, at 6:32 AM, Johan Kool wrote:
Roland,
Op 19-apr-2007, om 21:24 heeft Roland Torres het volgende geschreven:
I can't get NSOpenPanel's -runModalForDirectory:file:types: to
preselect a file.
[[NSOpenPanel openPanel] runModalForDirectory:@"/Users/roland/
chem" file:@"Hexachlorophene_37b.dat" types:nil];
My guess would be that the directory should be /Users/roland/chem/,
you omitted the last slash "/".
If you use the methods -stringByDeletingLastPathComponent and -
lastPathComponent you are less likely to make such mistakes:
NSString *filePath = @"/Users/roland/chem/Hexachlorophene_37b.dat";
int result = [oPanel runModalForDirectory:[filePath
stringByDeletingLastPathComponent]
file:[filePath lastPathComponent]
types:nil];
Hi Johan,
No, this does not make a difference. I guess this is a bug in OS X.
Roland
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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