# NSOpenPanel

scottc@net-community.com
boehring@biomed.ruhr-uni-bochum.de
n.pero@mi.flashnet.it
mirko.viviani@rccr.cremona.it

Standard panel for opening files

1996, 1998, 1999, 2000 Free Software Foundation, Inc.
Software documentation for the NSOpenPanel class
AppKit/NSOpenPanel.h
NSCoding

Implements a panel that allows the user to select a file or files. NSOpenPanel is based on the NSSavePanel implementation and shares a lot of similarities with it.

There is only one open panel per application and this panel is obtained by calling the +openPanel class method. From here, you should set the characteristics of the file selection mechanism using the -setCanChooseFiles: , -setCanChooseDirectories: and -setAllowsMultipleSelection: methods. The default is `YES` except for allowing multiple selection. When ready to show the panel, use the -runModalForTypes: , or a similar method to show the panel in a modal session. Other methods allow you to set the initial directory and initially selected file. The method will return one of NSOKButton or NSCancelButton depending on which button the user pressed.

Use the -filename or -filenames method to retrieve the name of the file the user selected.

openPanel
Returns the shared NSOpenPanel instance
URLs
Returns an array of the selected files as URLs
allowsMultipleSelection
Returns `YES` if the user is allowed to select multiple files. The default behavior is not to allow mutiple selections.
beginSheetForDirectory:
path
file:
name
types:
fileTypes
modalForWindow:
docWindow
modalDelegate:
delegate
didEndSelector:
didEndSelector
contextInfo:
contextInfo
Description forthcoming.
canChooseDirectories
Returns `YES` if the user is allowed to choose directories The default behavior is to allow choosing directories.
canChooseFiles
Returns `YES` if the user is allowed to choose files. The default behavior it to allow choosing files.
filenames
Returns an array containing the absolute paths (as NSString objects) of the selected files and directories. If multiple selections aren't allowed, the array contains a single name.
resolvesAliases
Description forthcoming.
runModalForDirectory:
path
file:
name
types:
fileTypes
Displays the open panel in a modal session, with the directory path shown and file name (if any) selected. Files are filtered for the specified types. If the directory is `nil`, then the directory shown in the open panel is the last directory selected.
runModalForDirectory:
path
file:
name
types:
fileTypes
relativeToWindow:
window
Description forthcoming.
runModalForTypes:
fileTypes
Displays the open panel in a modal session, filtering for files that have the specified types
setAllowsMultipleSelection:
flag
Allows the user to select multiple files if flag is `YES`.
setCanChooseDirectories:
flag
Allows the user to choose directories if flag is `YES`.
setCanChooseFiles:
flag
Allows the user to choose files if flag is `YES`
setResolvesAliases:
flag
Description forthcoming.