Re: [TxMt] Re: Save as Š dialogue

Allan Odgaard throw-away-1 at macromates.com
Thu Nov 9 16:54:13 UTC 2006


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.





More information about the textmate mailing list