discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: accessing/setting file name for NSSavePanel


From: Riccardo Mottola
Subject: Re: accessing/setting file name for NSSavePanel
Date: Fri, 27 Nov 2009 20:39:09 +0100
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.23) Gecko/20090906 SeaMonkey/1.1.18

Hi,

Is this in a document based application? If so, there is nothing you need to do. NSDocument already sets up the accessory menu so that the extension is switched when you change the document type. If you have built up your own accessory menu, you can call the save panel's -setRequiredFileType: method with the appropriate extension. Note that the save panel will automatically add the correct extension to the file name if it is missing when the user clicks OK (or when the name has a different extension). However, it will not show the extension automatically.
No, it is not document-based.
I was already using setRequirtedFileType. But as you write, the extension is not shown automatically. Furthermore two things confuse: the first call to the change extension won't actually change it..., the second yes. Thus when just opening a file with a certain extension, trying to save it with another file type would try to add a second extension. Mac warns about that. But the new extension wasn't been shown.

SO my solution is to first remove the file extension of the file. That way either it gets automatically (not shown, but set correctly) or at a change it will be shown.

I think maybe not totally straight, but that is how it is set up on the mac. Now I hope my code works on GNUstep.

Riccardo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]