On 9. Nov 2006, at 16:37, Matt Neuburg wrote:
Not really -- it’s a system dialog [...]
Not really. It's quite easy to select just the filename part:
NSTextView* fe = (NSTextView*)[theSavePanel firstResponder]; NSString* f = [[fe textStorage] string]; f = [f stringByDeletingPathExtension]; [fe setSelectedRange: NSMakeRange(0, [f length])];
Thanks, but when do you call this code?
Here is what I presently have:
NSSavePanel* savePanel = [NSSavePanel savePanel]; [savePanel setAccessoryView:encodingView]; [savePanel setTreatsFilePackagesAsDirectories:YES]; [savePanel beginSheetForDirectory:[aPath stringByDeletingLastPathComponent] file:([aPath lastPathComponent] ?: @"untitled") modalForWindow:[self window] modalDelegate:self didEndSelector:@selector (savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
Prior to calling beginSheetForDirectory:… there is no first responder in the panel, nor does the panel show the filename yet.