• 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: Custom View in Toolbar
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom View in Toolbar


  • Subject: Re: Custom View in Toolbar
  • From: Kyle Sluder <email@hidden>
  • Date: Mon, 8 Mar 2010 11:10:36 -0800

On Mon, Mar 8, 2010 at 10:58 AM, David Blanton <email@hidden> wrote:
> @implementation View

I would not recommend using this as the name for your NSView subclass,
since ObjC lacks namespaces. I doubt there's still a View class
hanging around anywhere, but it's safer to prefix it with some
initialism of your own.

> - (void)validate {
> [self setEnabled:YES];
> }

First of all, as the documentation you quoted explains, -validate is
an NSToolbarItem method, not an NSView method. If you want custom
validation logic for your view-based NSToolbarItem, you must subclass
NSToolbarItem and override -validate.

But since you're not actually doing any validation logic, there's no
need to implement custom validation at all, at least until you provide
an overflow menu representation for your toolbar item (which as the
documentation describes is disabled by default).

> and set this class to be the class of the enclosing tool bar item:

Looks like you changed your NSToolbarItem into a View by mistake.

--Kyle Sluder
_______________________________________________

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: Custom View in Toolbar
      • From: David Blanton <email@hidden>
References: 
 >Custom View in Toolbar (From: David Blanton <email@hidden>)
 >Re: Custom View in Toolbar (From: David Blanton <email@hidden>)
 >Re: Custom View in Toolbar (From: Kyle Sluder <email@hidden>)
 >Re: Custom View in Toolbar (From: David Blanton <email@hidden>)
 >Re: Custom View in Toolbar (From: Kyle Sluder <email@hidden>)
 >Re: Custom View in Toolbar (From: David Blanton <email@hidden>)

  • Prev by Date: Re: Custom View in Toolbar
  • Next by Date: Proper control for a list of actions
  • Previous by thread: Re: Custom View in Toolbar
  • Next by thread: Re: Custom View in Toolbar
  • Index(es):
    • Date
    • Thread