Re: Enabling add button
Re: Enabling add button
- Subject: Re: Enabling add button
- From: "I. Savant" <email@hidden>
- Date: Thu, 18 Dec 2008 14:11:43 -0500
On Thu, Dec 18, 2008 at 1:57 PM, Andre Masse <email@hidden> wrote:
> I'm using a classic master/detail view. The detail view has a bunch of
> fields, a table view and a button (with a shortcut) for adding rows to it.
> The table view is bound to an NSArrayController. Now, I want to enable the
> button only when the table view (in the detail view) has the focus. I tried
> to bind the "enable" property of the button to the "canInsert" controller
> key of the array controller but it doesn't work (it's always enabled). I
> guess I could subclass NSArrayController, override "canInsert" to check if
> the table view is the firstResponder but I'm wondering if there's another
> way...
Why do you need the button's enabled state to depend on which
control has focus? This is *not* usual Mac OS X UI behavior and is in
fact counterintuitive. As a user, I would never think to click inside
a table to enable an associated button. I would assume that - for
reasons unknown - I'm not allowed to add to that table because it is
grayed out. Unless, of course, I happen to click in the table first
... then I would still likely not associate the behavior with clicking
the table. I would most likely report this to you as a bug in the UI.
Most astute users would (if they bothered continuing to use a
perceived "buggy" application) as well.
I suggest you reconsider this. Better yet, post your reasons why you
feel this is necessary and maybe others can suggest alternatives.
At a guess, the reasoning is that you only want users to be able to
add to the details of the selected master object when a master object
is selected. Right? If you describe your setup a bit more
(particularly the controller and button bindings/targets), maybe we
can help you figure out why the add button is always enabled.
--
I.S.
_______________________________________________
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