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.
Questions tagged [nsopenpanel]
203 questions
3
votes
3 answers
How to close NSOpenPanel or why it doesn't close automatically?
I'm having hard time understanding how to close NSOpenPanel. It does close automatically, but it takes way longer than I want it to take.
Here is my code:
- (IBAction)startProcess:(id)sender
{
NSString *path = [Document openVideoFile]; // open…

Eugene Gordin
- 4,047
- 3
- 47
- 80
3
votes
3 answers
Add checkbox to NSOpenPanel
I would like to add a checkbox to NSOpenPanel, and then query its state when receiving the selected files. How can I do this?
Additionally, it would be desirable to be able to enable or disable the checkbox based on the current file selection.

hpique
- 119,096
- 131
- 338
- 476
3
votes
1 answer
NSOpenPanel crashes under Mountain Lion
In several of my projects I am using the following code:
NSOpenPanel * ProfilOpenPanel = [NSOpenPanel openPanel];
[ProfilOpenPanel setCanChooseFiles:YES];
[ProfilOpenPanel setCanChooseDirectories:NO];
[ProfilOpenPanel…

heimi
- 499
- 7
- 16
3
votes
0 answers
Customizing NSOpenPanel with iCloud UI
I'm using iCloud to store documents. So when user selects "Open file…" NSOpenPanel with iCloud UI is displayed. It contains "New document" button, but my app is registered as viewer for that extension. How can I customize NSOpenPanel to hide this…

vitamin
- 31
- 3
3
votes
0 answers
NSOpenPanel display issues
I'm using NSOpenPanel to allow the user to select a file. However, the UI of NSOpenPanel sometimes plays up. The sidebar sometimes is shown, sometimes it isn't. The selected folder (in this case, "Cookie Stumbler") can be moved to the…

Pripyat
- 2,937
- 2
- 35
- 69
3
votes
1 answer
NSOpenPanel not correctly accessing NSUrl from filename with Whitespace
Did a search, didn't find any issues on this.
My application takes .csv files, switches the data around and spits it out in a way my company finds useful. The issue is that the program seems to require filenames without whitespace. For instance "My…

Pinwheeler
- 1,061
- 2
- 13
- 26
3
votes
2 answers
How to get just the file name, not the full directory, with NSOpenPanel?
This is my code:
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection:YES];
[panel runModal];
NSInteger count = [[panel URLs] count];
for (int i=0; i

Pedro Vieira
- 3,330
- 3
- 41
- 76
3
votes
2 answers
NSOpenPanel allowed to select packages but not show contents
I am trying to get an NSOpenPanel to do the following:
Cannot select files
Can select directories and packages
Cannot see package contents
In order to get the first 2 points I need to use:
[openDlg setCanChooseFiles:NO];
[openDlg…

Ferguzz
- 5,777
- 7
- 34
- 41
2
votes
2 answers
How do I set the position and size of an NSOpenPanel dialog?
I don't have much experience with programming for Mac, I come from a Windows background.
So, I use this code to show an NSOpenPanel, but I also want to specify the position and size on screen of the dialog when it appears. How do I do…

sashoalm
- 75,001
- 122
- 434
- 781
2
votes
2 answers
How do I make my program wait for NSOpenPanel to close?
Like the title states, I need to make my program wait until my NSOpenPanel closes. I have the panel open in windowControllerWillLoadNib so that it happens before my document window opens. But what happens is that, it just loads both windows without…

sud0
- 537
- 4
- 18
2
votes
1 answer
How to use allowedContentTypes for the NSOpenPanel in macOS?
I'm trying to show the file picker window from my macOS GUI app written with SwiftUI. So I call this:
let panel = NSOpenPanel()
//panel.allowedFileTypes = ["myext"] //I get a warning here that it's deprecated
//Trying to use the following…

c00000fd
- 20,994
- 29
- 177
- 400
2
votes
4 answers
Why is NSOpenPanel/NSSavePanel showing memory leak?
Not sure why, but making a simple [[NSOpenPanel openPanel] runModal]; creates a memory leak - seen in Leaks Instrument.
Seems off.
It's an auto-released object, shouldn't it be automatically released after ARpool is drained?
Is there a way to fix…

AWF4vk
- 5,810
- 3
- 37
- 70
2
votes
1 answer
How do I get the NSOpenPanel Dialog to show the Media subsection
I would like to have the Media subsection in the sidebar of my Open File Dialog.It is visible in some Programs like Safari or Preview if you select File Open... and scroll down in the sidebar(It comes up underneath places, shared and search for)
I…

Caro
- 21
- 1
2
votes
0 answers
NSOpenPanel under Sandbox - Access Sockets in User Selected folder
In a sandboxed app, an NSOpenPanel doesn't display sockets, e.g. /tmp/mysqld.sock
The sockets do appear if you use
[urlArr setArray:[fm contentsOfDirectoryAtPath:selectedFilePath error:&err]];
urlArr contains the socket. But it hasn't been…

stoutyhk
- 243
- 4
- 10
2
votes
4 answers
NSDocumentController.openDocument not allowing selection of custom file type
I suspect this is a finicky configuration issue that I'm getting wrong with Document Type / UTI declarations in my Info.plist, but have tried several things and haven't found the solution.
I have an NSDocument-based Mac application, written in…

Corbell
- 1,283
- 8
- 15