Named Pasteboards

Data in the pasteboard server is associated with a name (a string) that indicates how it is to be used. Each set of data and its associated name is, in effect, a separate pasteboard, distinct from the others. An application keeps a separate NSPasteboard object for each named pasteboard that it uses. There are five standard pasteboards in common use, each named by a global string variable:

Pasteboard Name

Description

NSGeneralPboard

The pasteboard that is used for ordinary cut, copy, and paste operations. It holds the contents of the last selection that has been cut or copied.

NSFontPboard

The pasteboard that holds font and character information and supports Copy Font and Paste Font commands that may be implemented in a text editor.

NSRulerPboard

The pasteboard that holds information about paragraph formats in support of the Copy Ruler and Paste Ruler commands that may be implemented in a text editor.

NSFindPboard

The pasteboard that holds information about the current state of the active application’s Find panel. This information permits users to enter a search string into the Find panel, then switch to another application to conduct another search.

NSDragPboard

The pasteboard that stores data to be moved as the result of a drag operation. For additional information on working with the drag pasteboard, see Drag and Drop.

You can create private pasteboards by asking for an NSPasteboard object with any name other than those listed above. Data in a private pasteboard may then be shared by passing its name between applications.

The NSPasteboard class makes sure there is never more than one object for each named pasteboard on the computer for each user. If you ask for a new object when one has already been created for the pasteboard with that name, the existing object is returned.