I've created a subclass for NSToolbarItem
and am trying to catch the -(void)mouseDown:(NSEvent *)theEvent
in order to change its state (that's what I added in my subclass as NSToolbarItem
doesn't support states out of the box).
Problem is that the event mouseDown:
is never called, even though I set my toolbar items' class identities in Interface Builder to the one of my new class.
Why is this? NSToolbarItem is related to NSView
, so it should be capable of events no?
NSToolbarItem is a subclass of NSObject, not of NSResponder. The event is never called because it is never supposed to handle any. An NSToolbarItem is like a NSDictionary for an NSToolbar, it stores what it needs to draw.