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
4
votes
0 answers
NSOpenPanel doesn't show when i call runModal
Hello Because I spent hours looking for a solution and found none, and discovered the error I though I'd go out and post it.
I created an NSOpenPanel in the same way everyone is creating it set the file types that it accepts, and gave it a call to…

jeff
- 41
- 2
3
votes
1 answer
Doing something after NSOpenPanel closes
I have an NSOpenPanel and I want to do some validation of the selection after the user has clicked OK. My code is simple:
void (^openPanelHandler)(NSInteger) = ^(NSInteger returnCode) {
if (returnCode == NSFileHandlingPanelOKButton) {
//…

alexantd
- 3,543
- 3
- 27
- 41
3
votes
2 answers
How to save security scoped URL for later use macOS
I've made a Finder extension to add a menu to Finder's Context menu for any file. I'd like to access this file when the user selects this custom menu, obviously this file they select could be anywhere in the file system and outside the allowed…

Nathan
- 1,393
- 1
- 9
- 40
3
votes
1 answer
Swift Mac Os Application - NSSavePanel does not behave correctly with a 'background only' application
I'm developing a swift Mac OS app that works only in the status bar (with a popover) with Application is background only set to true.
Inside the popover the user can interact with a button to save an image, more specifically the following function…

madx
- 6,723
- 4
- 55
- 59
3
votes
1 answer
Completion handler never called for NSSavePanel beginWithCompletionHandler
When I open an NSSavePanel or NSOpenPanel instance with beginWithCompletionHandler: the handler is never called. Instead I see the panel appear for a fraction of a second, before it goes away again without letting the user select a file. When I open…

Mark
- 1,447
- 2
- 14
- 26
3
votes
1 answer
Customizing sandboxed NSSavePanel alert
I am validating urls from NSSavePanel using the delegate's panel(_:validate) method, throwing error in case of invalid url. In such case the NSSavePanel presents an alert, which I want to customize (meaning present some human readable description)…

Hubert Smazak
- 71
- 7
3
votes
2 answers
How to acquire a file path using objective c
I want a function which just returns the full file path of a file selected in finder.
I am currently have this function:
+ (NSString*)choosePathWindow:(NSString*)title buttonTitle:(NSString*)buttonTitle allowDir:(BOOL)dir allowFile:(BOOL)file{
…

maxisme
- 3,974
- 9
- 47
- 97
3
votes
1 answer
Close NSOpenPanel as soon as file/directory has been selected
I am new to NSOpenPanel/NSSavePanel/NSPanel. I am using NSOpenPanel to choose a directory whose files my app will iterate over and do some fairly time-consuming processing.
I can call -close on the panel, but that does not return focus to the main…

westsider
- 4,967
- 5
- 36
- 51
3
votes
1 answer
how to add a button for create new file in NSOpenPanel?(not create folder button)
macOS:how to add a button for creating new file in a NSOpenPanel?(not create folder button)

vivi wu
- 31
- 2
3
votes
2 answers
NSOpenPanel is not able to add accessoryView in El Capitan(10.11)
I have noticed a strange problem in El Capitan(10.11) - I am not able to add an accessoryView to NSOpenPanel.
It was OK for Mavericks(10.9) and Yosemite(10.10). Is there anything changed in 10.11?
Here is simple code:
let openPanel =…

brianLikeApple
- 4,262
- 1
- 27
- 46
3
votes
0 answers
NSOpenPanel error: NSConcreteMutableAttributedString initWithString:: nil value
I get this error when choosing a file in NSOpenPanel.
Im am using xCode 6.1.1 and Yosemite.
2015-02-19 21:21:11.396 Sagssystem[2239:56373] NSConcreteMutableAttributedString initWithString:: nil value
2015-02-19 21:21:11.399 Sagssystem[2239:56373] (
…
3
votes
2 answers
Presenting NSOpenPanel as sheet synchronously
I have a situation where a document file relies on a link to another external media file. When the document is opened, I check to see if the referenced media file is available and if not, then the user is prompted to locate it.
Since it makes…

martinjbaker
- 1,424
- 15
- 23
3
votes
3 answers
NSOpenPanel (doesn't) validateVisibleColumns
I have an NSOpenPanel with an accessoryView; in this view the user chooses a couple of radio button to change the allowed types. When the panel opens, the right files are enabled, the other disabled. Ok, good.
Now the user changes the radio buttons,…

max.me
- 105
- 7
3
votes
3 answers
NSOpenPanel runModal Crashes?
I'm have a routine based on code found on this forum:
+ (FSRef)useOpenFileToGetFSRef:(NSString **)fileName requiredFileType: (NSString*) requiredFileType
{
FSRef fileFSRef;
NSArray* fileTypes = [[NSArray alloc]…

VikR
- 4,818
- 8
- 51
- 96
3
votes
2 answers
Forcing the NSOpenPanel View Option
Is it possible to force or maybe even restrict the view option of an openPanel? For example I want the openPanel to only display the Cover flow view or Icon view upon activation. If restriction is not possible - how can I set the default…

Paul
- 189
- 10