Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 20. Pasteboards, Services, Modal... > Using the Pasteboard in GraphPaper

20.2. Using the Pasteboard in GraphPaper

To demonstrate how to use the pasteboard, we'll first modify the GraphPaper application so that a user can copy a graph to the pasteboard by choosing the Edit Copy menu command.

When you create a new project in Project Builder and then open the new MainMenu.nib file in Interface Builder, you are automatically provided with an Edit submenu like the one shown in Figure 20-1. The top seven menu items listed (all but the Find and Spelling submenus) come preconnected to the First Responder icon (a proxy icon in IB that represents the current First Responder object, which changes in response to user events). The methods invoked by the First Responder object in response to these menu commands are undo:, redo:, cut:, copy:, paste:, clear:, and selectAll:, respectively. Thus, to implement Cut and Copy menu commands for the graph, all we need to do is add cut: and copy: methods to GraphPaper's Controller class and make Controller the NSApp (NSApplication object) delegate. (Note that we already made Controller the NSApp delegate, in Chapter 17.) The cut: and copy: messages will automatically be forwarded to NSApp's delegate, unless another responder in the responder chain intercepts them first.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint