Why for only some actions must I call setTarget?

Posted by Max Pierce on Stack Overflow See other posts from Stack Overflow or by Max Pierce
Published on 2010-03-27T02:20:24Z Indexed on 2010/03/27 2:23 UTC
Read the original article Hit count: 214

Filed under:
|
|
|

For most actions, I just click and drag in InterfaceBuilder to "wire up" a call from some interface object to my code. For example, if I want to know when the user single-clicks a row in a table, I drag a connection from the table's action to my controller's action.

But now let's consider the user double-clicking a row. If I want one of my actions to be called when this happens, I need to call not only -[NSTableView setDoubleAction] but also -[NSControl setTarget]. Why?

To be clear, I am not asking why Interface Builder doesn't support setDoubleAction. All tools have limitations. I am trying to gain a greater understanding about how and why setTarget doesn't seem to be necessary unless and until I want setDoubleAction to work. Another way to ask this question would be: Why don't I need to do anything in Interface Builder to set the target of the table's (single-click) action?

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nstableview