<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSControl/select(withFrame:editor:delegate:start:length:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSControl(im)selectWithFrame:editor:delegate:start:length:"
  },
  "title" : "select(withFrame:editor:delegate:start:length:)"
}
-->

# select(withFrame:editor:delegate:start:length:)

Selects the specified text range in the receiver’s field editor.

```
func select(withFrame rect: NSRect, editor textObj: NSText, delegate: Any?, start selStart: Int, length selLength: Int)
```

## Parameters

`rect`

The bounding rectangle of the control’s cell.

`textObj`

The field editor to use.

`delegate`

The object to use as a delegate for the field editor. This delegate object receives various [`NSText`](/documentation/AppKit/NSText) delegation and notification methods during the course of editing the cell’s contents.

`selStart`

The start of the text selection.

`selLength`

The length of the text range.

## Discussion

This method is similar to [`edit(withFrame:editor:delegate:event:)`](/documentation/AppKit/NSControl/edit(withFrame:editor:delegate:event:)), except that it can be invoked in any situation, not only on a mouse-down event. This method returns without doing anything if `textObj` or the receiver is `nil`, or if the receiver has no font set for it.

---

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)