Re: How to get cursor on an NSTextView to go to the top...
Re: How to get cursor on an NSTextView to go to the top...
- Subject: Re: How to get cursor on an NSTextView to go to the top...
- From: Finlay Dobbie <email@hidden>
- Date: Sun, 2 Sep 2001 18:18:26 +0100
[myTextView scrollRangeToVisible:NSMakeRange(0,0)] should work.
See
file:///Developer/Documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/
Classes/NSText.html
-- Finlay
On Saturday, September 1, 2001, at 07:40 pm, Lloyd Sargent wrote:
I'm inserting text in an NSTextView via the following:
[myTextView insertText:myTextString];
Works fine, tastes great, except if the text string is larger than the
window it scrolls to the bottom. Well, I would like to programatically
move it to the top. I tried the following (based on someone's need to
move the cursor to the bottom):
[myTextView setSelectedRange:NSMakeRange(0, 0)];
Well that didn't work so I wondered if the index was supposed to be one
and tried the following:
[myTextView setSelectedRange:NSMakeRange(1, 0)];
No, go. What it did was select the text, BUT didn't move the cursor at
all i.e. the scroll-bar was at the bottom of my textview.
Okay, so HOW do I REALLY do this?
Cheers,
Lloyd
--------
Canna Software Development
"No llamas were frustrated by the NSTextView in the creation of this
e-mail"
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev