In addition to the delegate methods used by other controls, a table view object has several table-specific delegate methods. 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 NSTableView
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, send the appropriate message (checking first that the delegate responds to that message).
Note: Because the delegate methods involve data displayed by the NSTableView
object, the delegate is typically the same object as the data source. For more information about data source objects, see “Using a Table Data Source.”
The delegate can manage much of the table view behavior by implementing the following methods:
Delegate method | Description |
---|---|
Informs the delegate that the | |
| These methods give the delegate control over whether the user can select a particular row or column (though the user can still reorder columns). This is useful for disabling particular rows or columns. For example, in a database client application, when another user is editing a record you might want to prevent other users from selecting the row containing that record. |
Allows the delegate to deny a change in selection; for example, if the user is editing a cell and enters an improper value, the delegate can prevent the user from selecting or editing any other cells until a proper value has been entered into the original cell. | |
Asks the delegate whether it is permitted to edit a particular cell. The delegate can approve or deny the request. |
In addition to these methods, the delegate is also automatically registered to receive messages corresponding to NSTableView
notifications. These messages inform the delegate when the selection changes and when a column is moved or resized:
Delegate Message | Notification |
---|---|
© 1997, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-04-04)