Debugging NSTableView's "Action Invocation" binding
Q:
Why is my NSTableView
's "Action Invocation" binding not working?
A: Why is my NSTableView
's "Action Invocation" binding not working?
There could be several reasons why your action method is not being called:
You may have not included a ":" with the selector name for the appropriate bindings.
Some or all of the columns in the
NSTableView
are editable. This prevents the double-click action.Your
NSArrayController
might not be properly bound to the content ofNSTableView
.
NSTableView Bindings
The "Action Invocation" of NSTableView
involves two different bindings: doubleClickArgument
and doubleClickTarget
.
The binding doubleClickArgument
is a multiple-value binding that specifies the object passed as a parameter to the selector when NSTableView
receives a double click. The binding doubleClickTarget
is an object that receives a message corresponding to the selector name.
If your action method is defined in the Application's delegate, for example, use the following bindings for NSTableView
using InterfaceBuilder:
Action Invocation
Double Click Target
bind to = Application delegate object
model key path =
self
selector name =
clickAction:
Double Click Argument
bind to = array controller
controller key =
selectedObjects
selector name =
clickAction:
NSTableView Content
Content
bind to = array controller
controller key =
arrangedObjects
Selection Indexes
bind to = array controller
controller key =
selectedIndexes
Define Your Action Method
Write your action method with its argument as an NSArray
of "selectedObjects
".
Listing 1 Example action method.
- (void)clickAction:(NSArray*)selectedObjects { NSLog(@"double-click"); } |
Reference Material
For detailed information on NSTableView
bindings refer to:
Document Revision History
Date | Notes |
---|---|
2006-11-13 | New document that discusses the issues and factors that affect NSTableView's "Action Invocation" binding. |
Copyright © 2006 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2006-11-13