O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSOpenPanel — Mac OS X 10.0

Synopsis

This subclass of NSSavePanel implements a Mac OS X Open panel with which users are presented a filesystem browser interface to choose files or directories for the application to open. The Open panel is created by invoking the class method openPanel, and is displayed onscreen using any of the runModal... or beginSheet... methods. After an Open panel has been closed by the user, an application can obtain an array of the selected files or directories as paths or URLs using the method filenames or URLs.

image with no caption

@interface NSOpenPanel : NSSavePanel
                                  // Accessor Methods
   - (void)setCanChooseDirectories:(BOOL)flag;
   - (BOOL)canChooseDirectories;
   - (void)setCanChooseFiles:(BOOL)flag;
   - (BOOL)canChooseFiles;
   - (void)setResolvesAliases:(BOOL)flag;
   - (BOOL)resolvesAliases;
   - (void)setAllowsMultipleSelection:(BOOL)flag;
   - (BOOL)allowsMultipleSelection;
                                  // Class Methods
   + (NSOpenPanel *)openPanel;
                                  // Instance Methods
   - (NSArray *)URLs;
   - (void)beginSheetForDirectory:(NSString *)path 
                                 file:(NSString *)name 
                                 types:(NSArray *)fileTypes
                                 modalForWindow:(NSWindow *)docWindow  
                                 modalDelegate:(id)delegate  
                                 didEndSelector:(SEL)didEndSelector
                                 contextInfo:(void *)contextInfo;
   - (NSArray *)filenames;
   - (int)runModalForDirectory:(NSString *)path 
                                 file:(NSString *)name 
                                 types:(NSArray *)fileTypes;
   - (int)runModalForDirectory:(NSString *)path 
                                 file ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required