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: Wolfgang Lux
Subject: Re: accessing/setting file name for NSSavePanel
Date: Fri, 27 Nov 2009 00:55:22 +0100

Riccardo Mottola wrote:

Hi

I want to manipualte the filename of a NSSavePanel while it is shown. The events of the manipulation come from the accessoryview. I want to read it, modify it and set it back depending on events coming from the
accessory view components.
How can I do that? The documentation says that "filename" should be used only at the end of the modal session and I understand the events coming from the controls inside the accessoryviews are during a modal session.
Furthermore I found no provision on how to set the filename.

Any suggestions? The best solution would be portable to Mac, so I'd
prefer not to use internal variables/methods.

Thank you,
    Riccardo


I think the Open/SavePanel has a delegate that can be used to filter/
manipulate the file selection.
What I am not sure is how ou make the SavePanel call the delegate and
update the file name if you press the button of an accessory view.

well, yes there are some delegate methods, but they do not allow me to access and importantly set the filename.

What I want to achieve is the following:
You have a filename X.ext1

in the accessory view you select new settings which change the filetype, accordingly .ext1 should change to ext2. If you change settings again, ext2 should change to ext1 until you save.

Getting the events from the accessory view is easy: I can connect actions to it to a controller, it works. THe problem is the information about the filename and its extension.

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.

Wolfgang




reply via email to

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