[8] Review request for 7161437: [macosx] awt.FileDialog doesn't respond appropriately for mac when selecting folders (original) (raw)
Marco Dinacci marco.dinacci at gmail.com
Thu Aug 9 01:54:21 PDT 2012
- Previous message: [8] Review request for 7186371: [macosx] Main menu shortcuts not displayed (7u6 regression)
- Next message: [8] Review request for 7161437: [macosx] awt.FileDialog doesn't respond appropriately for mac when selecting folders
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
Just so that you know, the behavior of this dialog is different than the default OS X directory chooser behavior in that directory choosers to not allow users to also select files.
True but unfortunately if you allow only for directory selection (by passing NO to setCanChooseFiles: when fCanChooseDirectories is YES) then there's no way to allow for both file and directory selection. The best would be to have control over both setCanChooseFiles and setCanChooseDirectories from Java but I guess that's part of the RFE.
Also the default select button should read [Choose] and not [Open]. So in the CFileDialog.m file the private method :
The CFileDialog doesn't explicitly set the prompt string so I guess the behaviour depends on the OS version or on the localization. Setting it explicitly would override the default string and potentially confuse users. This test program on OSX Lion always displays "Open" no matter which combination of YES an NO I pass to setCanChooseFiles and setCanChooseDirectories. On which OS version do you see "Choose" ?
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize window = _window;
(void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSButton *button = [[[NSButton alloc] initWithFrame: NSMakeRect(10,10,120,40)] autorelease]; [[_window contentView] addSubview: button]; [button setTitle: @"Button"]; [button setTarget:self]; [button setAction:@selector(openDialog)]; }
(void)openDialog { NSOpenPanel* openDlg = [NSOpenPanel openPanel]; [openDlg setCanChooseFiles:YES]; [openDlg setCanChooseDirectories:YES]; [openDlg runModalForDirectory:nil file:nil]; }
@end
Best, Marco
- Previous message: [8] Review request for 7186371: [macosx] Main menu shortcuts not displayed (7u6 regression)
- Next message: [8] Review request for 7161437: [macosx] awt.FileDialog doesn't respond appropriately for mac when selecting folders
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]