Reputation: 6947
When I present a NSOpenPanel
to the user I'd like it to have a file that the user opened earlier already selected from the start.
There is [NSSavePanel setDirectoryURL:(NSURL*)
to preselect a directory, but I can't find an API to select the initial file.
There use to be:
- (NSInteger)runModalForDirectory:(NSString *)path file:(NSString *)filename
This call is exactly what I need. The docs say:
Specifies a particular file in path that is selected when the Save panel is presented to a user. When nil, no file is initially selected.
But unfortunately that method was deprecated in 10.6.
Upvotes: 1
Views: 989
Reputation: 16827
Do these NSSavePanel methods
- (void)setDirectoryURL:(NSURL *)url
- (void)setNameFieldStringValue:(NSString *)value
not do what you want?
NSOpenPanel is a subclass of NSSavePanel so it has these methods also.
Upvotes: 1