[TxMt] Re: Save as Š dialogue

Matt Neuburg matt at tidbits.com
Fri Nov 10 15:47:54 UTC 2006


On 11/9/06 8:54 AM, in article
4B7DE41E-932A-4263-AE89-B123B6EEAF9E at macromates.com, "Allan Odgaard"
<throw-away-1 at macromates.com> wrote:

> 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.

Obviously, I call my code after your code. m.

-- 
matt neuburg, phd = matt at tidbits.com, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>






More information about the textmate mailing list