Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSKeyBindingResponder

Package
com.apple.cocoa.application
Companion guide

Overview

This interface is implemented by objects in the responder chain that manipulate selections and edit text.

Tasks

Action Methods

Dispatch Methods

Instance Methods

cancelOperation

Implemented by subclasses to cancel the current operation.

public abstract void cancelOperation(Object sender)

Discussion

This method is bound to the Escape and Command-. (period) keys. The key window first propagates the key equivalent down its view hierarchy. If none of these views handles the key equivalent, the window sends a default action message of cancel to the first responder and from there the message travels up the responder chain. The sender argument is typically the object that invoked this method.

Availability

capitalizeWord

This action method capitalizes the word or words surrounding the insertion point or selection, expanding the selection if necessary.

public abstract void capitalizeWord(Object sender)

Discussion

If either end of the selection partially covers a word, that entire word is made lowercase.

See Also

centerSelectionInVisibleArea

This action method scrolls the selection, whatever it is, inside its visible area.

public abstract void centerSelectionInVisibleArea(Object sender)

See Also

changeCaseOfLetter

This action method changes the case of a letter or letters in the selection, perhaps by opening a panel with capitalization options or by cycling through possible case combinations.

public abstract void changeCaseOfLetter(Object sender)

See Also

complete

This action method completes an operation in progress or a partially constructed element.

public abstract void complete(Object sender)

Discussion

This method can be interpreted, for example, as a request to attempt expansion of a partial word, such as for expanding a glossary shortcut, or to close a graphics item being drawn.

deleteBackward

This action method deletes the selection, if there is one, or a single element backward from the insertion point (a letter or character in text, for example).

public abstract void deleteBackward(Object sender)

deleteBackwardByDecomposingPreviousCharacter

public abstract void deleteBackwardByDecomposingPreviousCharacter(Object sender)

Discussion

Implemented by subclasses to delete the selection, if there is one, or a single character backward from the insertion point. If the previous character is canonically decomposable, this method should try to delete only the last character in the grapheme cluster (for example, deleting “a”+ “´” results in “a”). The sender argument is typically the object that invoked this method.

Availability

deleteForward

This action method deletes the selection, if there is one, or a single element forward from the insertion point (a letter or character in text, for example).

public abstract void deleteForward(Object sender)

deleteToBeginningOfLine

This action method deletes the selection, if there is one, or all text from the insertion point to the beginning of a line (typically of text).

public abstract void deleteToBeginningOfLine(Object sender)

Discussion

Also places the deleted text into the kill buffer.

See Also

deleteToBeginningOfParagraph

This action method deletes the selection, if there is one, or all text from the insertion point to the beginning of a paragraph of text.

public abstract void deleteToBeginningOfParagraph(Object sender)

Discussion

Also places the deleted text into the kill buffer.

See Also

deleteToEndOfLine

This action method deletes the selection, if there is one, or all text from the insertion point to the end of a line (typically of text).

public abstract void deleteToEndOfLine(Object sender)

Discussion

Also places the deleted text into the kill buffer.

deleteToEndOfParagraph

This action method deletes the selection, if there is one, or all text from the insertion point to the end of a paragraph of text.

public abstract void deleteToEndOfParagraph(Object sender)

Discussion

Also places the deleted text into the kill buffer.

See Also

deleteToMark

This action method deletes the selection, if there is one, or all items from the insertion point to a previously placed mark, including the selection itself if not empty.

public abstract void deleteToMark(Object sender)

Discussion

Also places the deleted text into the kill buffer.

See Also

deleteWordBackward

This action method deletes the selection, if there is one, or a single word backward from the insertion point.

public abstract void deleteWordBackward(Object sender)

deleteWordForward

This action method deletes the selection, if there is one, or a single word forward from the insertion point.

public abstract void deleteWordForward(Object sender)

doCommandBySelector

Attempts to perform the method indicated by aSelector.

public abstract void doCommandBySelector(NSSelector aSelector)

Discussion

The method should take a single argument of type Object and return void. If the receiver responds to aSelector, it invokes the method with null as the argument. If the receiver doesn’t respond, it sends this message to its next responder with the same selector. NSWindow and NSApplication also send the message to their delegates. If the receiver has no next responder or delegate, it beeps.

See Also

indent

This action method indents the selection or the insertion point if there is no selection.

public abstract void indent(Object sender)

insertBacktab

This action method handles a “backward tab.”

public abstract void insertBacktab(Object sender)

Discussion

A field editor might respond to this method by selecting the field before it, while a regular text object either doesn’t respond to or ignores such a message.

insertNewline

This action method inserts a line-break character at the insertion point or selection, deleting the selection if there is one, or to end editing if the receiver is a text field or other field editor.

public abstract void insertNewline(Object sender)

insertNewlineIgnoringFieldEditor

This action method inserts a line-break character at the insertion point or selection, deleting the selection if there is one.

public abstract void insertNewlineIgnoringFieldEditor(Object sender)

Discussion

Unlike insertNewline, this method always inserts a line-break character and doesn’t cause the receiver to end editing.

insertParagraphSeparator

This action method inserts a paragraph separator at the insertion point or selection, deleting the selection if there is one.

public abstract void insertParagraphSeparator(Object sender)

insertTab

This action method inserts a tab character at the insertion point or selection, deleting the selection if there is one, or to end editing if the receiver is a text field or other field editor.

public abstract void insertTab(Object sender)

insertTabIgnoringFieldEditor

This action method inserts a tab character at the insertion point or selection, deleting the selection if there is one.

public abstract void insertTabIgnoringFieldEditor(Object sender)

Discussion

Unlike insertTab, this method always inserts a tab character and doesn’t cause the receiver to end editing.

insertText

Inserts anObject at the insertion point or selection, deleting the selection if there is one.

public abstract void insertText(Object anObject)

lowercaseWord

This action method lowercases every letter in the word or words surrounding the insertion point or selection, expanding the selection if necessary.

public abstract void lowercaseWord(Object sender)

Discussion

If either end of the selection partially covers a word, that entire word is made lowercase.

See Also

moveBackward

This action method moves the selection or insertion point one element or character backward.

public abstract void moveBackward(Object sender)

Discussion

In text, if there is a selection it should be deselected, and the insertion point should be placed at the beginning of the former selection.

moveBackwardAndModifySelection

This action method expands or reduce either end of the selection backward by one element or character.

public abstract void moveBackwardAndModifySelection(Object sender)

Discussion

If the end being modified is the backward end, this method expands the selection; if the end being modified is the forward end, it reduces the selection. The first moveBackwardAndModifySelection or moveForwardAndModifySelection method in a series determines the end being modified by always expanding. Hence, this method results in the backward end becoming the mobile one if invoked first.

See Also

moveDown

This action method moves the selection or insertion point one element or character down.

public abstract void moveDown(Object sender)

Discussion

In text, if there is a selection it should be deselected, and the insertion point should be placed below the beginning of the former selection.

moveDownAndModifySelection

This action method expands or reduces the top or bottom end of the selection downward by one element, character, or line (whichever is appropriate for text direction).

public abstract void moveDownAndModifySelection(Object sender)

Discussion

If the end being modified is the bottom, this method expands the selection; if the end being modified is the top, it reduces the selection. The first moveDownAndModifySelection or moveUpAndModifySelection method in a series determines the end being modified by always expanding. Hence, this method results in the bottom end becoming the mobile one if invoked first.

moveForward

This action method moves the selection or insertion point one element or character forward.

public abstract void moveForward(Object sender)

Discussion

In text, if there is a selection it should be deselected, and the insertion point should be placed at the end of the former selection.

moveForwardAndModifySelection

This action method expands or reduces either end of the selection forward by one element or character.

public abstract void moveForwardAndModifySelection(Object sender)

Discussion

If the end being modified is the backward end, this method reduces the selection; if the end being modified is the forward end, it expands the selection. The first moveBackwardAndModifySelection or moveForwardAndModifySelection method in a series determines the end being modified by always expanding. Hence, this method results in the forward end becoming the mobile one if invoked first.

See Also

moveLeft

This action method moves the selection or insertion point one element or character to the left.

public abstract void moveLeft(Object sender)

Discussion

In text, if there is a selection it should be deselected, and the insertion point should be placed at the left end of the former selection.

moveLeftAndModifySelection

Implemented by subclasses to expand or reduce either end of the selection to the left (display order) by one element or character.

public abstract void moveLeftAndModifySelection(Object sender)

Discussion

If the end being modified is the left end, this method expands the selection; if the end being modified is the right end, it reduces the selection. The first moveLeftAndModifySelection or moveRightAndModifySelection method in a series determines the end being modified by always expanding. Hence, this method results in the left end becoming the mobile one if invoked first.

The sender argument is typically the object that invoked this method.

The essential difference between this method and the corresponding moveBackwardAndModifySelection is that the latter method moves in logical order, which can differ in bidirectional text, whereas this method moves in display order.

Availability

moveRight

This action method moves the selection or insertion point one element or character to the right.

public abstract void moveRight(Object sender)

Discussion

In text, if there is a selection it should be deselected, and the insertion point should be placed at the right end of the former selection.

moveRightAndModifySelection

Implemented by subclasses to expand or reduce either end of the selection to the right (display order) by one element or character.

public abstract void moveRightAndModifySelection(Object sender)

Discussion

If the end being modified is the left end, this method reduces the selection; if the end being modified is the right end, it expands the selection. The first moveLeftAndModifySelection or moveRightAndModifySelection method in a series determines the end being modified by always expanding. Hence, this method results in the right end becoming the mobile one if invoked first.

The sender argument is typically the object that invoked this method.

The essential difference between this method and the corresponding moveForwardAndModifySelection is that the latter method moves in logical order, which can differ in bidirectional text, whereas this method moves in display order.

Availability

moveToBeginningOfDocument

This action method moves the selection to the first element of the document, or the insertion point to the beginning.

public abstract void moveToBeginningOfDocument(Object sender)

moveToBeginningOfLine

This action method moves the selection to the first element of the selected line, or the insertion point to the beginning of the line.

public abstract void moveToBeginningOfLine(Object sender)

moveToBeginningOfParagraph

This action method moves the insertion point to the beginning of the selected paragraph.

public abstract void moveToBeginningOfParagraph(Object sender)

moveToEndOfDocument

This action method moves the selection to the last element of the document, or the insertion point to the end.

public abstract void moveToEndOfDocument(Object sender)

moveToEndOfLine

This action method moves the selection to the last element of the selected line, or the insertion point to the end of the line.

public abstract void moveToEndOfLine(Object sender)

moveToEndOfParagraph

This action method moves the insertion point to the end of the selected paragraph.

public abstract void moveToEndOfParagraph(Object sender)

moveUp

This action method moves the selection or insertion point one element or character up.

public abstract void moveUp(Object sender)

Discussion

In text, if there is a selection it should be deselected, and the insertion point should be placed above the beginning of the former selection.

moveUpAndModifySelection

This action method expands or reduces the top or bottom end of the selection upward by one element, character, or line (whichever is appropriate for text direction).

public abstract void moveUpAndModifySelection(Object sender)

Discussion

If the end being modified is the bottom, this method reduces the selection; if the end being modified is the top, it expands the selection. The first moveDownAndModifySelection or moveUpAndModifySelection method in a series determines the end being modified by always expanding. Hence, this method results in the top end becoming the mobile one if invoked first.

moveWordBackward

This action method moves the selection or insertion point one word backward.

public abstract void moveWordBackward(Object sender)

Discussion

If there is a selection it should be deselected, and the insertion point should be placed at the end of the first word preceding the former selection.

See Also

moveWordBackwardAndModifySelection

This action method expands or reduces either end of the selection backward by one whole word.

public abstract void moveWordBackwardAndModifySelection(Object sender)

Discussion

If the end being modified is the backward end, this method expands the selection; if the end being modified is the forward end, it reduces the selection. The first moveWordBackwardAndModifySelection or moveWordForwardAndModifySelection method in a series determines the end being modified by always expanding. Hence, this method results in the backward end becoming the mobile one if invoked first.

See Also

moveWordForward

This action method moves the selection or insertion point one word forward.

public abstract void moveWordForward(Object sender)

Discussion

If there is a selection it should be deselected, and the insertion point should be placed at the beginning of the first word following the former selection.

See Also

moveWordForwardAndModifySelection

This action method expands or reduces either end of the selection forward by one whole word.

public abstract void moveWordForwardAndModifySelection(Object sender)

Discussion

Implemented by subclasses to move the selection or insertion point one word to the left, in display order.

If the end being modified is the backward end, this method reduces the selection; if the end being modified is the forward end, it expands the selection. The first moveWordBackwardAndModifySelection or moveWordForwardAndModifySelection method in a series determines the end being modified by always expanding. Hence, this method results in the forward end becoming the mobile one if invoked first.

See Also

moveWordLeft

Implemented by subclasses to expand or reduce either end of the selection left by one whole word in display order.

public abstract void moveWordLeft(Object sender)

Discussion

If there is a selection it should be deselected, and the insertion point should be placed at the end of the first word to the left of the former selection. The sender argument is typically the object that invoked this method.

The main difference between this method and the corresponding moveWordBackward method is that the latter moves in logical order, which is important in bidirectional text, whereas this method moves in display order.

Availability

moveWordLeftAndModifySelection

Implemented by subclasses to expand or reduce either end of the selection left by one whole word in display order.

public abstract void moveWordLeftAndModifySelection(Object sender)

Discussion

If the end being modified is the left end, this method expands the selection; if the end being modified is the right end, it reduces the selection. The first moveWordLeftAndModifySelection or moveWordRightAndModifySelection method in a series determines the end being modified by always expanding. Hence, this method results in the left end becoming the mobile one if invoked first.

The main difference between this method and the corresponding moveWordBackwardAndModifySelection method is that the latter moves in logical order, which is important in bidirectional text, whereas this method moves in display order.

The sender argument is typically the object that invoked this method.

Availability

moveWordRight

Implemented by subclasses to move the selection or insertion point one word right.

public abstract void moveWordRight(Object sender)

Discussion

If there is a selection it should be deselected, and the insertion point should be placed at the beginning of the first word to the right of the former selection. The sender argument is typically the object that invoked this method.

The main difference between this method and the corresponding moveWordForward method is that the latter moves in logical order, which is important in bidirectional text, whereas this method moves in display order.

Availability

moveWordRightAndModifySelection

Implemented by subclasses to expand or reduce either end of the selection to the right by one whole word.

public abstract void moveWordRightAndModifySelection(Object sender)

Discussion

If the end being modified is the backward end, this method reduces the selection; if the end being modified is the forward end, it expands the selection. The first moveWordBackwardAndModifySelection or moveWordForwardAndModifySelection method in a series determines the end being modified by always expanding. Hence, this method results in the forward end becoming the mobile one if invoked first. The sender argument is typically the object that invoked this method.

The main difference between this method and the corresponding moveWordForwardAndModifySelection method is that the latter moves in logical order, which is important in bidirectional text, whereas this method moves in display order.

Availability

pageDown

This action method scrolls the receiver down (or back) one page in its scroll view, also moving the insertion point to the top of the newly displayed page.

public abstract void pageDown(Object sender)

See Also

pageUp

This action method scrolls the receiver up (or forward) one page in its scroll view, also moving the insertion point to the top of the newly-displayed page.

public abstract void pageUp(Object sender)

See Also

scrollLineDown

This action method scrolls the receiver one line down in its scroll view, without changing the selection.

public abstract void scrollLineDown(Object sender)

See Also

scrollLineUp

This action method scrolls the receiver one line up in its scroll view, without changing the selection.

public abstract void scrollLineUp(Object sender)

See Also

scrollPageDown

This action method scrolls the receiver one page down in its scroll view, without changing the selection.

public abstract void scrollPageDown(Object sender)

See Also

scrollPageUp

This action method scrolls the receiver one page up in its scroll view, without changing the selection.

public abstract void scrollPageUp(Object sender)

See Also

selectAll

This action method selects all selectable elements.

public abstract void selectAll(Object sender)

selectLine

This action method selects all elements in the line or lines containing the selection or insertion point.

public abstract void selectLine(Object sender)

selectParagraph

This action method selects all paragraphs containing the selection or insertion point.

public abstract void selectParagraph(Object sender)

selectToMark

This action method selects all items from the insertion point or selection to a previously placed mark, including the selection itself if not empty.

public abstract void selectToMark(Object sender)

See Also

selectWord

This action method extends the selection to the nearest word boundaries outside it (up to, but not including, word delimiters).

public abstract void selectWord(Object sender)

setMark

This action method sets a mark at the insertion point or selection, which is used by deleteToMark and selectToMark.

public abstract void setMark(Object sender)

See Also

swapWithMark

This action method swaps the mark and the selection or insertion point, so that what was marked is now the selection or insertion point, and what was the insertion point or selection is now the mark.

public abstract void swapWithMark(Object sender)

See Also

transpose

This action method transposes the characters to either side of the insertion point and advances the insertion point past both of them. Does nothing to a selected range of text.

public abstract void transpose(Object sender)

transposeWords

This action method transposes the two words prior to the insertion point and advances the insertion point past both of them. Not currently implemented by NSTextView.

public abstract void transposeWords(Object sender)

uppercaseWord

This action method makes uppercase every letter in the word or words surrounding the insertion point or selection, expanding the selection if necessary.

public abstract void uppercaseWord(Object sender)

Discussion

If either end of the selection partially covers a word, that entire word is made uppercase.

See Also

yank

This action method replaces the insertion point or selection with text from the kill buffer.

public abstract void yank(Object sender)

Discussion

If invoked sequentially, cycles through the kill buffer in reverse order.

See Also


Next Page > Hide TOC


© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)


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.