< Previous PageNext Page > Hide TOC

Using an Outline View Delegate

NSOutlineView adds several delegate messages to those defined by its superclass, NSTableView. In addition, it redefines certain NSTableView delegate methods to be item-based instead of row-based. Together, these methods give the delegate control over the appearance of individual cells in the table, over changes in selection, and over editing of cells.

Delegate methods that request permission to alter the selection or edit a value are invoked during user actions that affect the outline view, but are not invoked by programmatic changes to the view. When making changes programmatically, you decide whether you want the delegate to intervene and, if so, you send the appropriate message (checking first that the delegate responds to that message). Because the delegate methods involve the actual data displayed by the outline view, the delegate is typically the same object as the data source, though this is not a requirement.

NSOutlineView redefines these delegate messages based on similar messages in NSTableView:

NSOutlineView defines these additional delegate messages:

In addition to these methods, the delegate is automatically registered to receive messages corresponding to NSOutlineView notifications. These inform the delegate when the selection changes or is about to change, when a column is moved or resized, and when an item is expanded or collapsed:

Delegate Message

Notification

outlineViewColumnDidMove:

NSOutlineViewColumnDidMoveNotification

outlineViewColumnDidResize:

NSOutlineViewColumnDidResizeNotification

outlineViewSelectionDidChange:

NSOutlineViewSelectionDidChangeNotification

outlineViewSelectionIsChanging:

NSOutlineViewSelectionIsChangingNotification

outlineViewItemDidExpand:

NSOutlineViewItemDidExpandNotification

outlineViewItemDidCollapse:

NSOutlineViewItemDidCollapseNotification



< Previous PageNext Page > Hide TOC


© 2001, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-06-28)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.