NSOpenPanel won't enable "Ok" button second time around
NSOpenPanel won't enable "Ok" button second time around
- Subject: NSOpenPanel won't enable "Ok" button second time around
- From: "Matt Mower" <email@hidden>
- Date: Fri, 5 Jan 2007 00:30:52 +0000
Hi.
I am using an NSOpenPanel in one of my applications in order to select
a folder. When the user selects "Ok" I save the folder into a user
default for the next time. However when the panel is opened a second
time, although the right folder is selected, the "Ok" button is not
enabled.
The requires the user to navigate up or down one level and back again
in order to get "Ok" to be re-enabled so that they can pick the
directory (in the likely case they want the same one).
I'd be grateful if anyone can help me work around this problem.
My code looks like this:
01 NSOpenPanel* browser = [NSOpenPanel openPanel];
02 NSString* directory = [[NSUserDefaults standardUserDefaults]
objectForKey:lastUsedPathKey];
03 if( directory != nil ) {
04 [browser setDirectory:directory];
05 }
06 [browser setCanChooseFiles:NO];
07 [browser setCanChooseDirectories:YES];
08 [browser setAllowsMultipleSelection:NO];
09 if( [browser runModal] != NSCancelButton ) {
10 NSString* choosenDirectory = [[browser filenames] objectAtIndex:0];
11 [[NSUserDefaults standardUserDefaults] setObject:choosenDirectory
forKey:lastUsedPathKey];
12 }
Many thanks,
Matt
--
Matt Mower :: http://matt.blogs.it/
_______________________________________________
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