Questions tagged [nsopenpanel]

NSOpenPanel is an Objective-C class used to provide users with a standard UI for opening files and directories on Mac OS X. It is part of the Apple Cocoa/Appkit frameworks.

203 questions
6
votes
0 answers

Is this a bug with NSOpenPanel, it causes the interface to hang for ~1 second?

Background Calling -beginWithCompletionHandler: on NSOpenPanel causes the user interface to hand of about a second after the use hits the open button. Two messages error messages are printed, * WARNING: Method userSpaceScaleFactor in class…
Daniel Farrell
  • 9,316
  • 8
  • 39
  • 62
5
votes
1 answer

NSOpenPanel Sheet

This is how I display an open panel as a floating window. Can someone help me out with running the panel as a sheet ? The window object is mWindow. Much of the standard code I was using is depreciated. NSOpenPanel *openPanel = [NSOpenPanel…
user1198008
  • 101
  • 1
  • 9
5
votes
1 answer

NSOpenPanel cannot get focus

First of all, I am completely new to Swift and I am sorry if my problem looks trivial. I would like to have a very simple command line program that opens a dialog to choose a file or a folder. This tool must not run an actual full app with an icon…
Slagt
  • 589
  • 2
  • 10
5
votes
2 answers

Restrict access to certain folders using NSOpenPanel

I'm using NSOpenPanel to allow a user to select a folder to save documents into. I would like to restrict what folder (in terms of hierarchy) they can save into. Essentially, I want to prevent them from choosing any folder above:…
minimalpop
  • 6,997
  • 13
  • 68
  • 80
5
votes
7 answers

Resize and Save NSImage?

I have an NSImageView which I get an image for from an NSOpenPanel. That works great. Now, how can I take that NSImage, half its size and save it as the same format in the same directory as the original as well? If you can help at all with anything…
Josh Kahane
  • 16,765
  • 45
  • 140
  • 253
5
votes
0 answers

NSOpenPanel dialog won't close

The problem in the title is exactly what happens with me. One I select the desired file, the open panel dialog becomes unselectable, but keeps above all the other windows. I will explains further: With a menu item in my app, I launch a configuration…
VitorMM
  • 1,060
  • 8
  • 33
5
votes
2 answers

NSOpenPanel/NSSavePanel crashes in Swift 3

In Swift 3/Xcode8.1/10.12.2 I am trying to use a NSOpenPanel to get a text file with the following code, written by DenBeke @IBAction func browseFile(sender: AnyObject) { let dialog = NSOpenPanel(); dialog.title = "Choose a…
heimi
  • 499
  • 7
  • 16
5
votes
1 answer

Security-Scoped Bookmarks for a directory

I need to give full read/write permission for a directory where the application write some file to this directory. I read that using sandboxed application it required to Enable Security-Scoped Bookmark and URL Access to access a folder after…
CodeDezk
  • 1,230
  • 1
  • 12
  • 40
4
votes
3 answers

Get filepath File Open Dialog box cocoa?

I have a File Open Dialog box in my application to select files from, but when the user clicks the 'Select' button in the box, it obviously won't do anything. How do I extract the filepath from the selected file? I need the filepath so I can get the…
user762034
4
votes
2 answers

How to open file using path inside user-selected file in sandboxed app

I am trying to write an import of a 3rd party file format in my macOS sandboxed app. The file the user opens is a Json document, and inside this document is a url pointing to some required external data file. In this case it is the relative path…
pjg
  • 565
  • 4
  • 19
4
votes
1 answer

NSOpenPanel under Sandbox - Access All Files inside User Selected folder

My sandboxed macOS app imports image files selected by the user via an NSOpenPanel modal window, as is customary. At first, I configured the panel to canChooseDirectories = false, and set the allowedFileTypes property to NSImage.imageTypes. So far…
Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189
4
votes
2 answers

NSOpenPanel not open and not working in swift 4 OS x app

Swift 4 / Xcode 9.2 / OS X 10.12 I am trying to use a NSOpenPanel to get a jpg/png file with the following code, but not able to open panel for choose image, no crash, nothing happened. let openPanel = NSOpenPanel() openPanel.allowsMultipleSelection…
user014276
  • 49
  • 3
4
votes
2 answers

getting plugin com.getdropbox.dropbox.garcon interrupted when open NSOpenPanel

I'm getting this messages on the console when I open a NSOpenPanel and then my application crashes: plugin com.getdropbox.dropbox.garcon interrupted plugin com.getdropbox.dropbox.garcon interrupted Unable to setup extension context - error: Couldn't…
pableiros
  • 14,932
  • 12
  • 99
  • 105
4
votes
2 answers

Getting URL From beginSheetModalForWindow:

I'm using an OpenPanel to get a file path URL. This works: [oPanel beginSheetModalForWindow:theWindow completionHandler:^(NSInteger returnCode) { NSURL *pathToFile = nil; if (returnCode == NSOKButton) pathToFile = [[oPanel URLs]…
spamguy
  • 1,575
  • 2
  • 17
  • 37
4
votes
2 answers

How to detect if a NSURL can be accessed on a Sandboxed app?

I'm writing an OS X application that has an open panel with a preview accessory view. The problem is that when I select a file that is not on a folder with sandbox permissions I cannot preview it. Is there any way to tell if a file can would be…
1
2
3
13 14