Re: InsertText on non editable NSTextView
Re: InsertText on non editable NSTextView
- Subject: Re: InsertText on non editable NSTextView
- From: Douglas Davidson <email@hidden>
- Date: Mon, 3 Jun 2002 15:45:53 -0700
On Monday, June 3, 2002, at 03:11 PM, Jesus De Meyer wrote:
I tried to do the insertText method on an NSTextView that was set to
not editable, but it didn't do much. Is there another way I could do
this? I know setSTring can, but setString doesn't scroll to the end of
the text (bottom line).
insertText: is the funnel point for text being typed into the text view,
so it is natural that it does not work on a non-editable text view.
There are many other means of programmatically altering the text,
however, starting with NSText methods like
replaceCharactersInRange:withString: (don't forget the superclass!).
The most flexible means is to simply modify the underlying
NSTextStorage. NSTextStorage is a subclass of
NSMutableAttributedString, and mutable attributed string methods may be
used upon it; if you are making multiple changes in sequence, for
efficiency you wil want to wrap them with calls to
beginEditing/endEditing.
You can scroll as you choose using e.g. scrollRangeToVisible:, another
NSText method.
Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.