Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSTextView extract raw text content

I want to find something that is the equivalent of [fieldName stringValue] for NSTextField, but for NSTextView. My understanding is that the stringValue property doesn't exist for the NSTextField because this field supports richer text.

Despite much googling I can't figure out how to just get the raw text content of the NSTextView. The only reason I'm using the NSTextView and not NSTextField is so I can have scroll bars...

Definitely a newb question!

Thanks in advance.

like image 312
ComputationalSocialScience Avatar asked Feb 12 '26 11:02

ComputationalSocialScience


1 Answers

NSTextField is a subclass of NSText, which has a "string" method. Try this:

[myTextField string];

It should work as needed.

like image 139
sosborn Avatar answered Feb 15 '26 13:02

sosborn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!