Protocol

NSTextViewDelegate

A set of optional methods that text view delegates can use to manage selection, set text attributes, work with the spell checker, and more.

Declaration

@protocol NSTextViewDelegate

Topics

Accessing Text System Objects

- undoManagerForTextView:

Returns the undo manager for the specified text view.

Controlling Display

- textView:willDisplayToolTip:forCharacterAtIndex:

Returns the actual tooltip to display.

Supporting Quick Look

- textView:URLForContentsOfTextAttachment:atIndex:

Returns a URL representing the document contents for a text attachment.

Managing the Selection

- textView:willChangeSelectionFromCharacterRanges:toCharacterRanges:

Returns the actual character ranges to select.

- textViewDidChangeSelection:

Sent when the selection changes in the text view.

Managing the Pasteboard

- textView:writablePasteboardTypesForCell:atIndex:

Returns the writable pasteboard types for a given cell.

- textView:writeCell:atIndex:toPasteboard:type:

Returns whether data of the specified type for the given cell could be written to the specified pasteboard.

Setting Text Attributes

- textView:shouldChangeTextInRange:replacementString:

Sent when a text view needs to determine if text in a specified range should be changed.

- textView:shouldChangeTextInRanges:replacementStrings:

Sent when a text view needs to determine if text in an array of specified ranges should be changed.

- textView:shouldChangeTypingAttributes:toAttributes:

Sent when the typing attributes are changed.

- textViewDidChangeTypingAttributes:

Sent when a text view’s typing attributes change.

Clicking and Pasting

- textView:clickedOnCell:inRect:atIndex:

Sent when the user clicks a cell.

- textView:doubleClickedOnCell:inRect:atIndex:

Sent when the user double-clicks a cell.

- textView:clickedOnLink:atIndex:

Sent after the user clicks a link.

Working With the Spelling Checker

- textView:shouldSetSpellingState:range:

Sent when the spelling state is changed.

- textView:willCheckTextInRange:options:types:

Invoked to allow the delegate to modify the text checking process before it occurs.

- textView:didCheckTextInRange:types:options:results:orthography:wordCount:

Invoked to allow the delegate to modify the text checking results after checking has occurred.

Dragging

- textView:draggedCell:inRect:event:atIndex:

Sent when the user attempts to drag a cell.

Text Completion

- textView:completions:forPartialWordRange:indexOfSelectedItem:

Returns the actual completions for a partial word.

Control Sharing Service Picker

- textView:willShowSharingServicePicker:forItems:

Returns a sharing service picker for the current selection.

Performing Commands

- textView:doCommandBySelector:

Sent to allow the delegate to perform the command for the text view.

Contextual Menu Management

- textView:menu:forEvent:atIndex:

Allows delegate to control the context menu returned by the text view.

Deprecated Methods

- textView:clickedOnLink:

Sent after the user clicks on a link.

Deprecated
- textView:draggedCell:inRect:event:

Sent when the user attempts to drag a cell.

Deprecated
- textView:clickedOnCell:inRect:

Sent when the user clicks a cell.

Deprecated
- textView:doubleClickedOnCell:inRect:

Sent when the user double-clicks a cell.

Deprecated

Relationships

Inherits From

See Also

Text Views

NSTextField

Text that the user can select or edit and that sends its action message to its target when the user presses the Return key.

NSTextFieldDelegate

A protocol that a text field delegate can use to control its field editor action menu.

NSTextView

A view that draws text and handles user interactions with that text.

NSText

The most general programmatic interface for objects that manage text.