Questions tagged [nssavepanel]

An NSSavePanel object creates and manages a Save panel and allows you to run the panel in a modal loop

An NSSavePanel object creates and manages a Save panel and allows you to run the panel in a modal loop. The Save panel provides a simple way for a user to specify a file to use when saving a document or other data. It can restrict the user to files of a certain type, as specified by an extension.

An NSSavePanel object manages a panel that allows users to specify the directory and name under which a file is saved. It supports browsing of the file system, and it accommodates custom accessory views.

An NSSavePanel object may have a delegate. The methods that delegates of NSSavePanel may implement are specified by the NSOpenSavePanelDelegate protocol.

In a sandboxed app, when a user saves a document, the Save dialog is presented by the powerbox, not AppKit. OS X then adds the saved file to the app’s sandbox (if necessary) to allow the app to write to the file.

More: NSSavePanel Class Reference

118 questions
0
votes
1 answer

NSSavePanel missing "shouldRunSavePanelWithAccessoryView" key?

I have the code below, which presents a save panel in my SwiftUI macOS App. It needs to be able to display a file format picker, which is available in the standard accessory view. However, the key to enable this view seems to be missing (Value of…
Michel Storms
  • 336
  • 3
  • 10
0
votes
1 answer

NSSavePanel getting warning: "please start panels using NSSavePanel rather than NSApplication or NSWindow"

Running in macOS 10.15.6, built with Xcode 11.1, my app is suddenly (at least I just noticed) spitting out these warnings on the console when I present a save dialog: WARNING: found it necessary to prepare implicitly;…
James Bucanek
  • 3,299
  • 3
  • 14
  • 30
0
votes
0 answers

NSSavePanel selects both filename and extension in Catalina

I always run macOS with the Finder options set to show extensions. I have some code that opens an NSSavePanel. In macOS versions before Catalina, it opened with only the filename selected and not the extension. Starting in Catalina, the entire…
rpatters1
  • 382
  • 1
  • 11
0
votes
0 answers

How can I make NSSavePanel use the system's language?

I have a Java application on macOS that uses SWT. Sometimes this application needs to ask for a filename. Now, while SWT has a file dialog, this is sort of broken in recent versions. So I made my own file dialog that uses JNA to create an…
user2543253
  • 2,143
  • 19
  • 20
0
votes
2 answers

URL saveAs extension

When this URL extension is run as a panel it fails to return a URL, seemingly bypassing the completion: func saveAs() -> URL? { let savePanel = NSSavePanel() var saveAsURL : URL? = nil savePanel.canCreateDirectories = true …
slashlos
  • 913
  • 9
  • 17
0
votes
0 answers

NSOpenPanel and NSSavePanel localization

I use non English (Czech) UI of macOS Mojave and XCode 10.0 where I want to use NSOpenPanel and NSSavelPanel in my Swift 4.2 application. Some text items used in panels I can localize via NSOpenPanel/NSSavePanel classes properties but some (like…
Dawy
  • 770
  • 6
  • 23
0
votes
0 answers

Show Mac devices in NSOpenPanel/NSSavePanel

For a given NSOpenPanel or NSSavePanel you can set a directory to show with: [panel setDirectoryURL:[NSURL fileURLWithPath:@"/SomeFolder"]]; There you can set whatever path you like, but how can you show the Network or Mac devices? Mac devices…
aone
  • 57
  • 8
0
votes
0 answers

NSSavePanel does nothing

The following code does nothing. No error messages, no save dialog. Why? let FS = NSSavePanel() FS.canCreateDirectories = true FS.allowedFileTypes = ["text", "txt"] FS.begin { (result: Int) -> Void in if result == NSFileHandlingPanelOKButton { …
benwiggy
  • 1,440
  • 17
  • 35
0
votes
1 answer

NSSavePanel accessoryView: Why doesn't my button appear?

I am creating a save panel with an accessoryView that contains a single checkbox. I can get it to work when I create the button using: NSButton(checkboxWithTitle: "Check Me", target: self, action: #selector(checkBoxSelected)) But this gives me a…
MH175
  • 2,234
  • 1
  • 19
  • 35
0
votes
1 answer

macOS Change extension dialog appears as a new window instead of another sheet

I have an app that lets the user input a file, process it, then lets the user save the file. I ran into a small problem with the save dialog. The file type that my app allows the user to save should only be txt files. But I do allows the user to use…
Tom Shen
  • 1,838
  • 3
  • 19
  • 40
0
votes
1 answer

Save file but hide file extension - Cocoa with Key Value Coding

I'm saving some objects to a file using Key Value Coding. I'd like the extension of the saved file to be hidden (or at least be hidden unless the value in Finder → Preferences → Advanced "Show All File Extensions" is true), but I can't seem to get…
glenstorey
  • 5,134
  • 5
  • 39
  • 71
0
votes
1 answer

How to ask folder permission in Sandbox in OS X like this window?

When it needs folder permission in Sandbox, The Unarchiver will show a window like below. I can ask permission myself using NSSavePanel, but there is an extra file name text field. If I try NSOpenPanel, the open button is grey. So my question is,…
Owen Zhao
  • 3,205
  • 1
  • 26
  • 43
0
votes
1 answer

Customising NSDocument's NSSavePanel

As I edit and then try to close a document in my document-based app, an NSSavePanel pops up. It says, "Do you want to save the changes made to the document “Untitled”?" Is there any way to alter this message? -setMessage: does not do anything,…
0
votes
0 answers

Opening NSSavePanel as sheet

I am using XCode7 beta2 to play around with Swift 2. Trying to use a File-Selection Dialog (NSSavePanel) brought me into some trouble. Running the following code by clicking the associated button won't bring up the dialog as a sheet (not at all)…
techshack
  • 359
  • 2
  • 18
0
votes
1 answer

Strange Bug:thanks, but I need to control my own subviews

2014-11-08 17:24:46.487 Intelligent Notes[4472:303] APP-reportExceptionthanks, but I need to control my own subviews 2014-11-08 17:24:46.488 Intelligent Notes[4472:303] thanks, but I need to control my own subviews 2014-11-08 17:24:46.494…
John Chen
  • 27
  • 6