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
27
votes
6 answers

NSOpenPanel in Swift . How to open?

I have this Objective-C Code : - (IBAction)selectFileButtonAction:(id)sender { //create open panel... NSOpenPanel* openPanel = [NSOpenPanel openPanel]; // NSLog(@"Open Panel"); //set restrictions / allowances... [openPanel…
C-Viorel
  • 1,801
  • 3
  • 22
  • 41
22
votes
2 answers

How do I change "Open" to "Select" in the NSOpenPanel?

In my Application i need to show the select file dialog, I am making use of the NSOpenPanel which allows to select the file, code is as shown below, - (IBAction)sendFileButtonAction:(id)sender{ NSOpenPanel* openDlg = [NSOpenPanel…
Amitg2k12
  • 3,765
  • 10
  • 48
  • 97
16
votes
2 answers

NSOpenPanel setAllowedFileTypes

I have a NSOpenPanel. But I want to make it PDF-files selectable only. I'm looking for something like that: // NOT WORKING NSOpenPanel *panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel…
Andreas Prang
  • 2,187
  • 4
  • 22
  • 33
13
votes
3 answers

NSOpenPanel - Everything deprecated?

I've been trying to get a window to show up asking the person to choose a file, and I eventually did. The problem is, Xcode complains that the method I'm using is deprecated. I looked in the class reference, but everything under the "running panels"…
Cole
  • 720
  • 1
  • 8
  • 18
12
votes
1 answer

Trouble creating Security-Scoped Bookmark

I'm converting my Lion app to use the App Sandbox. I'm trying to make use of the security-scoped bookmarks feature introduced in 10.7.3 to allow persistent access to a folder. The code I have below returns a nil bookmark, and produces the following…
Dov
  • 15,530
  • 13
  • 76
  • 177
10
votes
2 answers

NSOpenPanel as sheet

Ive looked around at other answers, but nothing seems to be helping my case. I have a viewController class which contains an IBAction for a button. This button should open a NSOpenPanel as a sheet from that viewController: class ViewController:…
OrangePot
  • 1,053
  • 2
  • 14
  • 38
9
votes
1 answer

Title bar missing in NSOpenPanel?

Since OS X 10.11 it seems the title bar no longer appears even when using setTitle: does anyone know what happened and how to get the old behavior back?
rick
  • 451
  • 3
  • 13
8
votes
4 answers

Make NSOpenPanel open a custom directory

is there any way that I can pass a URL to a folder on my system which should be the default window which an NSOpenPanel opens? Thanks! Update: NSOpenPanel *ads_open = [[NSOpenPanel openPanel] retain]; [ads_open…
Kevin
  • 1,469
  • 2
  • 19
  • 28
7
votes
1 answer

NSOpenPanel crash in sandbox inherited process

I have an application running in the sandbox which launches a helper application bundle using NSTask (the helper is contained within the bundle of the app). Using the correct entitlements the main app is able to launch the helper using NSTask and…
GenericPtr
  • 677
  • 1
  • 8
  • 18
7
votes
1 answer

NSOpenPanel in sandboxed app ignores provided directory URL

I am building sandboxed OS X app (OS X 10.10.5, Xcode 6.4). In the course of execution I open NSOpenPanel object. Then I run next snippet: NSString* s=[@"~" stringByExpandingTildeInPath]; NSOpenPanel* panel = [NSOpenPanel openPanel]; [panel…
BorisV
  • 683
  • 3
  • 20
6
votes
1 answer

XCTestCase save file? (Record NSSavePanel)?

I am trying to record a test case in which an NSDocument create and saves a file (then opens + verifies the contents again). The problem is when I record my test case, once a NSSavePanel is launched, the XCTestCase recording stops. I've tried to…
Kyle
  • 17,317
  • 32
  • 140
  • 246
6
votes
0 answers

NSOpenPanel Swift Warning Message on OSX 10.12

Recently upgrade to macOS Sierra version 10.12, Xcode version 8.2.1 The following code works on OS Sierra but with a warning message. It works on the previous OS El Capitan 10.11 without warning message. Anyone can advise how to get rip of this…
David Evony
  • 273
  • 3
  • 15
6
votes
1 answer

"Failed to updated [sic] bookmark for item" on [NSOpenPanel openPanel] invocation

My Mac app is designed to edit and analyse graphs, which users can create and store in files anywhere on the file system. I go to user to let them open a previously created file with [NSOpenPanel openPanel] and an inline completion handler block.…
Cope
  • 769
  • 7
  • 17
6
votes
2 answers

Setting initial directory for NSOpenPanel

I'm trying to get the user to select a file from a folder containing log files. So I want to display an NSOpenDialog showing the contents of that folder. I'm using Swift, so 10.9+ I see a number of threads on this topic here, but in spite of trying…
Maury Markowitz
  • 9,082
  • 11
  • 46
  • 98
6
votes
1 answer

How do you "preselect" a file in the NSOpenPanel dialog

Does anyone know how to preselect a file in the NSOpenPanel dialog? This has been asked several times before, but none of those questions were answered with a working solution. Setting nameFieldStringValue has no effect as the open dialog does not…
hvanbrug
  • 1,291
  • 2
  • 12
  • 25
1
2 3
13 14