Instance Method

beginSheetModalForWindow:completionHandler:

Presents the panel as a sheet modal to the specified window.

Declaration

- (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSModalResponse result))handler;

Parameters

window

The window in which the panel will be presented.

handler

The block called after the user dismisses the panel. The argument passed in will be NSFileHandlingPanelOKButton if the user chose the OK button or NSFileHandlingPanelCancelButton if the user chose the Cancel button.

Discussion

Any properties of the panel you wish to set should be set before calling this method. Although the completion handler block is called after the user dismisses the panel, the panel sheet may still be visible onscreen. If you need to remove the sheet from the screen—for example, if the completion block displays an alert—first call [savePanel orderOut:nil] to close the sheet.

See Also

Running Panels

- beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:

Presents a Save panel as a sheet with a specified path and, optionally, a specified file in that path.

Deprecated
- beginWithCompletionHandler:

Presents the panel as a modeless window.

- runModal

Displays the panel and begins its event loop with the current working (or last selected) directory as the default starting point.

- runModalForDirectory:file:

Initializes the panel to the directory and file specified, if any, then displays it and begins its modal event loop.

Deprecated
- panel:compareFilename:with:caseSensitive:

Controls the ordering of files presented by the NSSavePanel object specified.

Deprecated
- panel:isValidFilename:

Gives the delegate the opportunity to validate selected items.

Deprecated
- validateVisibleColumns

Validates and possibly reloads the browser columns visible in the panel by invoking the delegate method panel:shouldShowFilename:.

- panel:shouldShowFilename:

Gives the delegate the opportunity to filter items that it doesn’t want the user to choose.

Deprecated
- panel:directoryDidChange:

Tells the delegate that the user has changed the selected directory in the NSSavePanel object specified.

Deprecated