---
title: "textView(_:clickedOn:in:at:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextviewdelegate/textview(_:clickedon:in:at:)"
---

# textView(_:clickedOn:in:at:)

Sent when the user clicks a cell.

## Declaration

```swift
@MainActor optional func textView(_ textView: NSTextView, clickedOn cell: any NSTextAttachmentCellProtocol, in cellFrame: NSRect, at charIndex: Int)
```

## Parameters

- `textView`: The text view sending the message.
- `cell`: The cell clicked by the user.
- `cellFrame`: The frame of the clicked cell.
- `charIndex`: The character index of the clicked cell.

## Discussion

Discussion The delegate can use this message as its cue to perform an action or select the attachment cell’s character. aTextView is the first text view in a series shared by a layout manager, not necessarily the one that draws cell. The delegate may subsequently receive a textView(_:doubleClickedOn:in:at:) message if the user continues to perform a double click.

## See Also

### Clicking and Pasting

- [textView(_:doubleClickedOn:in:at:)](appkit/nstextviewdelegate/textview(_:doubleclickedon:in:at:).md)
- [textView(_:clickedOnLink:at:)](appkit/nstextviewdelegate/textview(_:clickedonlink:at:).md)
