Mac OS X Reference Library Apple Developer
Search

Deprecated NSSavePanel Methods

A method identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in Mac OS X v10.3

selectText:

This method has been deprecated. (Deprecated in Mac OS X v10.3. There is no replacement.)

- (IBAction)selectText:(id)sender

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.3.
Declared In
NSSavePanel.h

Deprecated in Mac OS X v10.6

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 in Mac OS X v10.6. Use beginSheetModalForWindow:completionHandler: instead.)

- (void)beginSheetForDirectory:(NSString *)path file:(NSString *)name modalForWindow:(NSWindow *)docWindow modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo

Parameters
path

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.

name

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

docWindow

If not nil, the Save panel slides down as a sheet running as a document modal window in docWindow. If nil, the behavior defaults to a standalone modal window.

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. The NSSavePanel object does not retain the modal delegate.

didEndSelector

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

- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;

The value passed as returnCode is either NSCancelButton or NSOKButton.

contextInfo

Context information passed to modalDelegate in the didEndSelector message.

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
Declared In
NSSavePanel.h

directory

Returns the absolute pathname of the directory currently shown in the panel. (Deprecated in Mac OS X v10.6. Use directoryURL instead.)

- (NSString *)directory

Return Value

The absolute pathname of the directory currently shown in the panel.

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
Declared In
NSSavePanel.h

filename

Returns the absolute pathname of the file currently shown in the panel. (Deprecated in Mac OS X v10.6. Use URL instead.)

- (NSString *)filename

Return Value

The absolute pathname of the file.

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
See Also
Declared In
NSSavePanel.h

requiredFileType

Returns the required file type (if any). (Deprecated in Mac OS X v10.6. Use allowedFileTypes instead.)

- (NSString *)requiredFileType

Return Value

The required file type (if any).

Discussion

A file specified in the Save panel is saved with the designated filename and this file type as an extension. Examples of common file types are “rtf”, “tiff”, and “ps”. File type strings encoding HFS file types are not valid values for this attribute. An nil return value indicates that the user can save to any ASCII file.

This method is equivalent to calling allowedFileTypes and returning the first element of the list of allowed types, or nil if there are none.

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
Declared In
NSSavePanel.h

runModalForDirectory:file:

Initializes the panel to the directory and file specified, if any, then displays it and begins its modal event loop. (Deprecated in Mac OS X v10.6. Use runModal instead.)

- (NSInteger)runModalForDirectory:(NSString *)path file:(NSString *)filename

Parameters
path

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 path that is selected when the Save panel is presented to a user. When nil, no file is initially selected.

Return Value

NSFileHandlingPanelOKButton (if the user clicks the OK button) or NSFileHandlingPanelCancelButton (if the user clicks the Cancel button).

Discussion

This method invokes NSApplication’s runModalForWindow: method with self as the argument.

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
See Also
Declared In
NSSavePanel.h

setDirectory:

Sets the current pathname in the panel’s browser. (Deprecated in Mac OS X v10.6. Use setDirectoryURL: instead.)

- (void)setDirectory:(NSString *)path

Parameters
path

String to set as the panel’s current pathname.

Discussion

The path argument must be an absolute pathname.

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
Declared In
NSSavePanel.h

setRequiredFileType:

Specifies the type, an extension to be appended to any selected files that don’t already have that extension; “nib” and “rtf” are examples. (Deprecated in Mac OS X v10.6. Use setAllowedFileTypes: instead.)

- (void)setRequiredFileType:(NSString *)type

Parameters
type

String to set as the extension to be appended to any selected files that don’t already have that extension.

Discussion

The argument type should not include the period that begins the extension. Pass nil to indicate any type. File type strings encoding HFS file types are not valid values for this attribute. You need to invoke this method each time the Save panel is used for another file type within the application.

This method is equivalent to calling setAllowedFileTypes: with an array containing only type (unless type is nil, and then it’s equivalent to calling setAllowedFileTypes: with nil).

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
Declared In
NSSavePanel.h

panel:compareFilename:with:caseSensitive:

Controls the ordering of files presented by the NSSavePanel object specified. (Deprecated in Mac OS X v10.6. There is no replacement.)

- (NSComparisonResult)panel:(id)sender compareFilename:(NSString *)fileName1 with:(NSString *)fileName2 caseSensitive:(BOOL)flag

Parameters
sender

Panel requesting the ordering.

fileName1

String representing the first filename to order.

fileName2

String representing the second filename to order.

flag

If YES, the ordering is case-sensitive; if NO, it is not.

Return Value

One of the following:

Discussion

Don’t reorder filenames in the Save panel without good reason, because it may confuse the user to have files in one Save panel or Open panel ordered differently than those in other such panels or in the Finder. The default behavior of Save and Open panels is to order files as they appear in the Finder. Note also that by implementing this method you will reduce the operating performance of the panel.

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
Declared In
NSSavePanel.h

panel:directoryDidChange:

Tells the delegate that the user has changed the selected directory in the NSSavePanel object specified. (Deprecated in Mac OS X v10.6. Use panel:didChangeToDirectoryURL: (NSOpenSavePanelDelegate) instead.)

- (void)panel:(id)sender directoryDidChange:(NSString *)path

Parameters
sender

Panel whose directory has changed.

path

String representing the new directory’s path.

Availability
  • Available in Mac OS X v10.3 and later.
  • Deprecated in Mac OS X v10.6.
See Also
Declared In
NSSavePanel.h

panel:isValidFilename:

Gives the delegate the opportunity to validate selected items. (Deprecated in Mac OS X v10.6. Use panel:validateURL:error: (NSOpenSavePanelDelegate) instead. If both methods are implemented, the URL version will be called.)

- (BOOL)panel:(id)sender isValidFilename:(NSString *)filename

Parameters
sender

Panel requesting filename validation.

filename

String representing the filename to validate.

Return Value

YES if the filename is valid, or NO if the save panel should stay in its modal loop and wait for the user to type in or select a different filename or names.

Discussion

The NSSavePanel object sender sends this message just before the end of a modal session for each filename displayed or selected (including filenames in multiple selections). If the delegate refuses a filename in a multiple selection, none of the filenames in the selection is accepted.

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
See Also
Declared In
NSSavePanel.h

panel:shouldShowFilename:

Gives the delegate the opportunity to filter items that it doesn’t want the user to choose. (Deprecated in Mac OS X v10.6. Use panel:shouldEnableURL: (NSOpenSavePanelDelegate).)

- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename

Parameters
sender

Panel that is querying whether it should show a certain file.

filename

String representing the name of the file to be loaded in the browser.

Return Value

YES if filename should be selectable, and NO if the save panel should disable the file or directory.

Discussion

The NSSavePanel object sender sends this message to the panel’s delegate for each file or directory (filename) it is about to load in the browser.

Availability
  • Available in Mac OS X v10.0 and later.
  • Deprecated in Mac OS X v10.6.
See Also
Declared In
NSSavePanel.h



Last updated: 2009-02-19

Did this document help you? Yes It's good, but... Not helpful...