---
title: hasMarkedText
framework: AppKit
role: symbol
role_heading: Instance Method
platforms: [macOS 10.0+]
path: appkit/nstextinput/hasmarkedtext
---

# hasMarkedText

Returns a Boolean value indicating whether or not the receiver has marked text.

## Declaration

```occ
- (BOOL) hasMarkedText;
```

## Return Value

Return Value true if the receiver has marked text, false if it doesn’t.

## Discussion

Discussion Unlike other methods in this protocol, this one is not called by an input server. The text view itself may call this method to determine whether there currently is marked text. NSTextView, for example, disables the Edit > Copy menu item when this method returns true.

## See Also

### Deprecated methods

- [markedRange](appkit/nstextinput/markedrange.md)
- [selectedRange](appkit/nstextinput/selectedrange.md)
- [setMarkedText:selectedRange:](appkit/nstextinput/setmarkedtext:selectedrange:.md)
- [unmarkText](appkit/nstextinput/unmarktext.md)
- [validAttributesForMarkedText](appkit/nstextinput/validattributesformarkedtext.md)
- [attributedSubstringFromRange:](appkit/nstextinput/attributedsubstringfromrange:.md)
- [insertText:](appkit/nstextinput/inserttext:.md)
- [characterIndexForPoint:](appkit/nstextinput/characterindexforpoint:.md)
- [firstRectForCharacterRange:](appkit/nstextinput/firstrectforcharacterrange:.md)
- [doCommandBySelector:](appkit/nstextinput/docommandbyselector:.md)
- [conversationIdentifier](appkit/nstextinput/conversationidentifier.md)
