Re: Insert text at end of Textview
Re: Insert text at end of Textview
- Subject: Re: Insert text at end of Textview
- From: Arthur Clemens <email@hidden>
- Date: Thu, 3 Oct 2002 15:54:06 +0200
On donderdag, okt 3, 2002, at 14:50 Europe/Amsterdam, Alexander
Griekspoor wrote:
>
Hello all,
>
>
I've tried to search the archives, but couldn't find an answer to the
>
following question:
>
How do I make sure that my text is inserted at the end of the contents
>
of my textview?
>
I now how to make my textview first responder, and how to insert the
>
text with
>
[myTextView insertText: @"blabla"];
>
I guess I have to set the selection first with:
>
[myTextView setSelectedRange: NSMakeRange(X,Y)]; where X marks the last
>
position in the text, and Y the length (guess it should be 0 in my
>
case). The problem is, how do I find out what the last character
>
position is in my textview.
unsigned maxValue = [[textview textStorage] length] - 1;
[textview setSelectedRange:NSMakeRange(maxValue, 0)];
[textview insertText: @"blabla"];
Arthur Clemens
_______________________________________________
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.