Declaration

Return Value

Discussion

If multiple files or directories are allowed, then the filename method—inherited from NSSavePanel—returns a non-nil value only if one and only one file is selected. By contrast, NSOpenPanel’s URLs method always returns the URLs of the selected files, even if only one file is selected.

Parameters

The directory whose files the panel displays. When nil, the directory is the same directory used in the previous invocation of the panel; this is probably the best choice for most situations.

filename

Specifies a particular file in absoluteDirectoryPath that is selected when the Open panel is presented to the user. When nil, no file is initially selected.

fileTypes

An array of file extensions and/or HFS file types. Specifies the files the panel allows the user to select. nil makes all files in absoluteDirectoryPath selectable by the user. An array of types passed in here will override one set using setAllowedFileTypes:.

modelessDelegate

This is not the same as a delegate assigned to the panel. This delegate is temporary and the relationship only lasts until the panel is dismissed.

didEndSelector

The message sent to modelessDelegate after the panel’s session has ended, but before dismissing the Open panel. didEndSelector may dismiss the Open panel itself; otherwise, it will be dismissed on return from the method. The corresponding method should have the following signature:

Parameters

The directory whose files the panel displays. When nil, the directory is the same directory used in the previous invocation of the panel; this is probably the best choice for most situations.

filename

Specifies a particular file in absoluteDirectoryPath that is selected when the Open panel is presented to the user. When nil, no file is initially selected.

fileTypes

An array of file extensions and/or HFS file types. Specifies the files the panel allows the user to select. nil makes all files in absoluteDirectoryPath selectable by the user. An array of types passed in here will override one set using setAllowedFileTypes:.

docWindow

The window to open the sheet on.

modalDelegate

This is not the same as a delegate assigned to the panel. This delegate is temporary and the relationship only lasts until the panel is dismissed..

didEndSelector

The message sent to modalDelegate after the modal session has ended, but before dismissing the Open panel. didEndSelector may dismiss the Open panel itself; otherwise, it will be dismissed on return from the method. The corresponding method should have the following signature:

Declaration

Parameters

The directory whose files the panel displays. When nil, the directory is the same directory used in the previous invocation of the panel; this is probably the best choice for most situations.

filename

Specifies a particular file in absoluteDirectoryPath that is selected when the Open panel is presented to the user. When nil, no file is initially selected.

fileTypes

An array of file extensions and/or HFS file types. Specifies the files the panel allows the user to select. nil makes all files in absoluteDirectoryPath selectable by the user. An array of types passed in here will override one set using setAllowedFileTypes:.

Return Value

The button clicked to dismiss the dialog: NSOKButton for the OK button and NSCancelButton for the Cancel button.

Deprecation Statement

Declaration

Parameters

fileTypes

An array of file extensions and/or HFS file types. Specifies the files the panel allows the user to select. nil makes all files selectable by the user. An array of types passed in here will override one set using setAllowedFileTypes:.

Return Value

The button used to dismiss the dialog: NSOKButton for the OK button and NSCancelButton for the Cancel button.

Deprecation Statement

Declaration

Return Value

The array of filenames.

Discussion

If multiple selections aren’t allowed, the array contains a single name. The filenames method is preferable over NSSavePanel’s filename to get the name or names of files and directories that the user has selected.