In Cocoa, how do you define a class that sends an action? I want to be able to connect the action to the selector of another object in IB in the style of NSButton. I would prefer not to subclass NSControl if possible.
                +2 
                A: 
                
                
              - Give it a property (informal is fine) holding an 
id, for the target. I'm not sure whether this should retain or not; I'd say no, since the target will normally be the controller that owns the window that (indirectly) owns the view. - Give it a property (informal in fine) holding a 
SEL, for the action. - Respond to 
mouseUp:andkeyDown:(checking that the key in question is the space bar or return or enter) by sending yourself anaccessibilityPerformAction:message, passingNSAccessibilityPressAction. - Respond to the 
accessibilityPerformAction:message by either sending your action message to your target (NSAccessibilityPressAction) or calling up tosuper(other), as described in the documentation for that method. 
You should also implement the rest of the NSAccessibility protocol while you're at it. Test that work with a mix of the Accessibility Inspector and VoiceOver.
                  Peter Hosey
                   2010-09-06 01:08:02
                
              Thanks Peter! That's what I was looking for.
                  Max
                   2010-09-06 01:56:43