The code I wrote does indeed set that attribute to true but ⌘ A is not working. Here's my MCV example that does everything except allow me to select all items. BTW, if I use "true" instead of "YES", then it behaves the same way.
Multiple selections work but it won't let me select all. I would have expected select all to work even in the context below.
#import <Cocoa/Cocoa.h>
void openDialog () {
@try {
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseFiles:YES];
[panel setCanChooseDirectories:YES];
[panel setAllowsMultipleSelection:YES];
if ([panel runModal] == NSModalResponseOK) {
for ( NSURL* URL in [panel URLs] ) {
NSLog( @"%@", [URL path] );
}
} else {
NSLog( @"ok button not pressed");
}
} @catch (NSException *exception) {
NSLog(@"%@", [exception callStackSymbols]);
}
}
void setup () {
NSWindow *myWindow;
NSRect graphicsRect = NSMakeRect(100.0, 350.0, 400.0, 400.0);
myWindow = [ [NSWindow alloc]
initWithContentRect: graphicsRect
styleMask:NSWindowStyleMaskTitled
|NSWindowStyleMaskClosable
|NSWindowStyleMaskMiniaturizable
backing:NSBackingStoreBuffered
defer:NO ];
[myWindow setTitle:@"Open File App"];
[myWindow makeKeyAndOrderFront: nil];
openDialog();
}
int main ( ) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSApp = [NSApplication sharedApplication];
setup();
[NSApp run];
[NSApp release];
[pool release];
return(EXIT_SUCCESS);
}