• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Disabled button looks like enabled
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disabled button looks like enabled


  • Subject: Re: Disabled button looks like enabled
  • From: Dave DeLong <email@hidden>
  • Date: Mon, 12 Jan 2009 12:57:47 -0700

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


  • Follow-Ups:
    • Re: Disabled button looks like enabled
      • From: "Donnie Lee" <email@hidden>
References: 
 >Disabled button looks like enabled (From: "Donnie Lee" <email@hidden>)
 >Re: Disabled button looks like enabled (From: Ricky Sharp <email@hidden>)
 >Re: Disabled button looks like enabled (From: Luca <email@hidden>)
 >Re: Disabled button looks like enabled (From: "Donnie Lee" <email@hidden>)
 >Re: Disabled button looks like enabled (From: "I. Savant" <email@hidden>)
 >Re: Disabled button looks like enabled (From: "Donnie Lee" <email@hidden>)
 >Re: Disabled button looks like enabled (From: Andy Lee <email@hidden>)
 >Re: Disabled button looks like enabled (From: "Donnie Lee" <email@hidden>)
 >Re: Disabled button looks like enabled (From: Dave DeLong <email@hidden>)
 >Re: Disabled button looks like enabled (From: "Donnie Lee" <email@hidden>)
 >Re: Disabled button looks like enabled (From: Dave DeLong <email@hidden>)
 >Re: Disabled button looks like enabled (From: Andy Lee <email@hidden>)
 >Re: Disabled button looks like enabled (From: Dave DeLong <email@hidden>)

  • Prev by Date: Detecting mouseover in an NSActionCell subclass
  • Next by Date: Re: Release vs. autorelease
  • Previous by thread: Re: Disabled button looks like enabled
  • Next by thread: Re: Disabled button looks like enabled
  • Index(es):
    • Date
    • Thread