Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
Nil-Targeted Actions
How is the cut:, copy:, or paste: message sent to the correct view? After all, there are many, many views. If you select a text field, it should get the message. When you select another view and then choose the Copy or Paste menu item, the message should go to the newly selected view.
To solve this problem, the clever engineers at NeXT came up with nil-targeted actions.
If you set the target of a control to nil,
the application will try to send the action message to several objects until one of them responds.
The application first tries to send the message to the first responder of the key window.
This is exactly the behavior that you want for
Cut and Paste. You can have several windows, each of which can have ...