<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSControlTextEditingDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSControlTextEditingDelegate"
  },
  "title" : "NSControlTextEditingDelegate"
}
-->

# NSControlTextEditingDelegate

A set of optional methods implemented by delegates of [`NSControl`](/documentation/AppKit/NSControl) subclasses to respond to editing actions.

```
protocol NSControlTextEditingDelegate : NSObjectProtocol
```

## Topics

### Validating a Control’s Value

[`-  control:isValidObject:`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:isValidObject:))

Invoked when the insertion point leaves a cell belonging to the specified control, but before the value of the cell’s object is displayed.

[`-  control:didFailToValidatePartialString:errorDescription:`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:didFailToValidatePartialString:errorDescription:))

Invoked when the formatter for the cell belonging to `control` (or selected cell) rejects a partial string a user is typing into the cell.

### Responding to Text Formatting

[`-  control:didFailToFormatString:errorDescription:`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:didFailToFormatString:errorDescription:))

Invoked when the formatter for the cell belonging to the specified control cannot convert a string to an underlying object.

### Responding to Text Editing

[`-  control:textShouldBeginEditing:`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textShouldBeginEditing:))

Invoked when the user tries to enter a character in a cell of a control that allows editing of text (such as a text field or form field).

[`-  control:textShouldEndEditing:`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textShouldEndEditing:))

Invoked when the insertion point tries to leave a cell of the control that has been edited.

### Working with Text Completion

[`-  control:textView:completions:forPartialWordRange:indexOfSelectedItem:`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textView:completions:forPartialWordRange:indexOfSelectedItem:))

Invoked to allow you to control the list of proposed text completions generated by text fields and other controls.

### Working with Key Bindings

[`-  control:textView:doCommandBySelector:`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textView:doCommandBy:))

Invoked when users press keys with predefined bindings in a cell of the specified control.

### Instance Methods

[`-  controlTextDidBeginEditing:`](/documentation/AppKit/NSControlTextEditingDelegate/controlTextDidBeginEditing(_:))

Tells the delegate that the control started editing its text content.

[`-  controlTextDidChange:`](/documentation/AppKit/NSControlTextEditingDelegate/controlTextDidChange(_:))

Tells the delegate that the control made changes to its text content.

[`-  controlTextDidEndEditing:`](/documentation/AppKit/NSControlTextEditingDelegate/controlTextDidEndEditing(_:))

Tells the delegate that the control finished editing its text content and committed the changes.

## Relationships

### Inherited By

[`NSMatrixDelegate`](/documentation/AppKit/NSMatrixDelegate)

[`NSSearchFieldDelegate`](/documentation/AppKit/NSSearchFieldDelegate)

[`NSTextFieldDelegate`](/documentation/AppKit/NSTextFieldDelegate)

[`NSTableViewDelegate`](/documentation/AppKit/NSTableViewDelegate)

[`NSComboBoxDelegate`](/documentation/AppKit/NSComboBoxDelegate)

[`NSTokenFieldDelegate`](/documentation/AppKit/NSTokenFieldDelegate)

[`NSOutlineViewDelegate`](/documentation/AppKit/NSOutlineViewDelegate)

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)