Re: Disabled button looks like enabled
Re: Disabled button looks like enabled
- Subject: Re: Disabled button looks like enabled
- From: "Donnie Lee" <email@hidden>
- Date: Mon, 12 Jan 2009 23:28:33 +0300
It's exactly what I need, Dave. Thank you!
A small question: there is "Enable access for assistive devices" in
Universal Access, what do you think, can any of these devices treat my
fake button as a real button (even if the button don't accepts "first
responder")? Or removing first responder from a button guarantees that
it never be accessible?
On Mon, Jan 12, 2009 at 10:57 PM, Dave DeLong <email@hidden> wrote:
> I'll also point out that this will work for any NSButton flavor (checkboxes,
> help, recessed, etc). I just did some further testing to make sure that
> these buttons refuse the focus, and they definitely don't accept being first
> responder. I created an interface with a bunch of normal buttons, wired up
> the nextKeyView to be sequential, and then wired the last of the normal
> buttons to the first of the FakeButtons. (I also wired the first normal
> button to be initialFirstResponder). I turned on full access in SysPrefs,
> then ran the app.
>
> Hitting the tab button will ONLY tab through the normal buttons. Even
> though one of the FakeButtons is wired to be the nextKeyView, since it
> refuses first responder, it just jumps to the next thing that does accept
> first responder (this being one of the normal buttons).
>
> If that doesn't do what he's asking for, then I have no clue what will.
>
> Dave
>
> On Jan 12, 2009, at 12:18 PM, Dave DeLong wrote:
>
>> Aha, I see what you're saying. Well, I just played around with this, and
>> subclassing an NSButton as follows will create a button that looks enabled
>> but won't respond to mouse clicks and also won't allow users to tab to the
>> button (ie, disallows the focus):
>>
>> @interface FakeButton : NSButton { }
>> @end
>>
>> @implementation FakeButton
>>
>> - (BOOL) acceptsFirstReponder { return NO; }
>>
>> - (BOOL) becomeFirstResponder { return NO; }
>>
>> - (void) mouseDown:(NSEvent *)event { return; }
>>
>> - (void) mouseUp:(NSEvent *)event { return ; }
>>
>> @end
>>
>> Just tried it and it works as I've described above.
>>
>> Dave
>
> _______________________________________________
>
> 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
>
_______________________________________________
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