Technical Q&A QA1472

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:

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:

Cocoa Bindings Reference - NSTableView Bindings



Document Revision History


DateNotes
2006-11-13

New document that discusses the issues and factors that affect NSTableView's "Action Invocation" binding.