Re: Custom View in Toolbar
Re: Custom View in Toolbar
- Subject: Re: Custom View in Toolbar
- From: David Blanton <email@hidden>
- Date: Mon, 8 Mar 2010 12:19:56 -0700
You did not look at what I provided.
@interface View : NSToolbarItem {
@public
}
@end
@implementation View
- (void)validate {
[self setEnabled:YES];
}
@end
View is a subclass of NSToolbarItem. So validate is being called on
the NSToolbarItem.
I believe you have no clue about any of this so I will end the
discussion.
Thanks for the run around.
-db
On Mar 8, 2010, at 12:10 PM, Kyle Sluder wrote:
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