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: Johan Kool <email@hidden>
- Date: Fri, 20 Apr 2007 15:32:25 +0200
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];
Johan
---
http://www.johankool.nl/
_______________________________________________
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