Re: Scroll an NSTextView to a new place
Re: Scroll an NSTextView to a new place
- Subject: Re: Scroll an NSTextView to a new place
- From: Daniel Jalkut <email@hidden>
- Date: Tue, 19 Feb 2008 12:49:34 -0500
Sorry - I neglected to realize there isn't a "scrollToPoint" in NSView.
Use scrollRectToVisible instead. On the text view.
D
On Feb 19, 2008, at 12:46 PM, John Stiles wrote:
Great, how would I go about this exactly?
Daniel Jalkut wrote:
In general you shouldn't try to manipulate the clip view yourself.
Just scroll the document view and let the magic happen.
"Scrolls the receiver’s closest ancestor NSClipView object so a
point in the receiver lies at the origin of the clip view's bounds
rectangle."
There is magic in NSView hierarchy to do the searching/make it
happen/trigger the updates.
Daniel
On Feb 19, 2008, at 12:34 PM, John Stiles wrote:
How do you change the scroll location of an NSTextView
+NSScrollView programmatically?
I've got code which seems like it ought to work, but when I call
it, it causes the text view's contents to vanish (the text view
appears to have nothing in it). If I resize the text view, it
fixes and shows the expected results, but this seems to indicate
that I'm not doing something right.
What I've got now:
NSRect visibleRect = [myTextView visibleRect];
NSClipView* clipView = [myScrollView contentView];
[clipView scrollToPoint:NSMakePoint(visibleRect.origin.x,
newVerticalPosition)];
[myScrollView reflectScrolledClipView:clipView];
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden