Re: NSOpenPanel - disabling the "Open" button for certain folders.
Re: NSOpenPanel - disabling the "Open" button for certain folders.
- Subject: Re: NSOpenPanel - disabling the "Open" button for certain folders.
- From: Ron Aldrich <email@hidden>
- Date: Mon, 02 Feb 2009 16:59:55 -0800
On Feb 2, 2009, at 3:47 PM, Corbin Dunn wrote:
On Feb 2, 2009, at 11:48 AM, Mike Abdullah wrote:
Sadly I'm pretty certain there's no API to disable the button. But
you can fairly easily implement the -panel:isValidFilename:
delegate method and return NO to stop the user opening a folder.
Calling NSBeep() at the same time wouldn't be amiss I imagine.
That's correct; the right way to use the openpanel is to tell it the
set of UTIs/extensions that it can open. Or, if that isn't good
enough, use the above delegate method to tell it if a file is okay
or not. The panel really works in a set of "valid filenames" and not
"is the open button enabled".
I think that's the whole point - a set of "valid filenames" is an
appropriate way for the open panel to determine whether or not the
open button is enabled, but isn't entirely appropriate for determining
whether or not the items in the list are enabled.
If the item in the list happens to be a folder, then the user may want
to navigate into it rather than open it. Since the enable state of
both the open button and the list item are controlled by the same
logic, there is no way to get the desired behavior (which is for the
folder to be enabled in the list, but disabled at the open button).
That's why I was asking if there was a way to control the Open button
separately from the list.
If you really need this ability, please log a feature request bug,
and state why you need it. thanks,
Done.
Ron
corbin
Mike.
On 30 Jan 2009, at 01:18, Ron Aldrich wrote:
Hello,
I'm trying to filter the contents of a standard NSOpenPanel dialog
such that only certain folders can be opened.
If I implement - (BOOL) panel:(id)sender shouldShowFilename:
(NSString *) fileName; such that it returns true for the folders
that I want to allow, and false for others, it prevents the user
from navigating their hard drive.
The problem is, that the result of panel:shouldShowFilename:
controls both the the ability to navigate within a folder, and
whether or not the "Open" button is enabled.
So, is there a way to control the enable state of the "Open"
button for a folder, without preventing the user from navigating
into that folder?
Thanks for your time,
Ron Aldrich
Software Architects, Inc.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden