Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Scrolling an NSScrollView ...

Scrolling an NSScrollView ...
Thread Tools
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jul 9, 2001, 02:07 PM
 
Hello ...

Now that I've solved the autoresizing problem with my scrolling text field, I can't seem to wrap my mind around getting the scrolling to work.

The text field (an NSTextView within an NSScrollView) is a simple, enabled, uneditable (but selectable) field. As the program runs, I programmatically append more and more stuff to the enclosed text. I want the field to automatically scroll to its bottom as this happens, but I can't even get the scroll "thumb" to appear when the text disappears below the bottom of the window.

The documentation has me more than a little confused. Isn't the "Clip View" supposed to monitor the "Content View" (the text view in this case) and update all the scrolling components as needed? If not, then what am I supposed to do to update all that stuff (and get the field to always scroll to the bottom)?


HyperCard was so much easier ...


Thanks and regards,

DayLateDon
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jul 12, 2001, 02:17 AM
 
Hello ...


Received an answer via USENET.

The scroll-to-bottom trick is handled by sending "scrollRangeToVisible:" to the text view.

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
[myTextView scrollRangeToVisible:
NSMakeRange([[myTextView textStorage] length], <font color = blue>0</font>)];
</font>[/code]


Regards,

Don
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:12 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2