Debugging NSTableView's "Action Invocation" binding

Q: Why is my NSTableView's "Action Invocation" binding not working?

A: 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 of NSTableView.

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:

Back to Top 

NSTableView Content

Content

  • bind to = array controller

  • controller key = arrangedObjects

Selection Indexes

  • bind to = array controller

  • controller key = selectedIndexes

Back to Top 

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");
}

Back to Top 

Reference Material

For detailed information on NSTableView bindings refer to:

Cocoa Bindings Reference - NSTableView Bindings

Back to Top 

Document Revision History

DateNotes
2006-11-13First Version

Posted: 2006-11-13


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.