Re: Behavior of NSTextView scrollRangeToVisible
Re: Behavior of NSTextView scrollRangeToVisible
- Subject: Re: Behavior of NSTextView scrollRangeToVisible
- From: Fritz Anderson <email@hidden>
- Date: Wed, 12 May 2004 11:34:48 -0500
I can shed only a little more light on the question.
First, the message sent by the Jump to Selection menu item is
centerSelectionInVisibleArea:, not scrollRangeToVisible:. Therefore,
the behavior shown in case 3 is correct, and 1 and 2 would seem to be
incorrect.
Second, in the case of Wrap to Page mode, the document view of the
NSScrollView in TextEdit is not an NSTextView, but a MultiplePageView,
a custom NSView that presents several NSTextViews in page rectangles.
The first responder, however, is the currently-active NSTextView, so
the same class should be implementing the action in both cases.
My guess -- this is only a guess -- is that whoever implemented
centerSelectionInVisibleArea: for NSTextView did it "the right way" for
the case in which the NSTextView was the only thing being scrolled, but
did not attempt the harder task of implementing it for embedded
NSTextViews, and simply passed the work off to scrollRangeToVisible:.
As solving the general problem could be complex, I sympathize.
-- F
On 12 May 2004, at 2:58 AM, Satoshi Matsumoto wrote:
I have a question about the behavior of NSTextView
scrollRangeToVisible.
In TextEdit, NSTextView scrollRangeToVisible shows 3 different
behaviors.
1. In the Wrap to Page mode, when current scroll position is less than
target position that is going to be scrolled, the result target
position
appears at the bottom of the window.
2. In the Wrap to Page mode, when current scroll position is greater
than
target position, the result target position appears at the top of the
window.
3. But in the Wrap to Window mode, the result target position always
appears
at the center of the window.
You can reproduce above 3 behaviors by executing the Menu
Edit>Find>Jump to
Selection (cmd+J).
Why the behaviors of scrollRangeToVisible are different between Wrap
to Page
mode and Wrap to Window mode? And How to control these behavior of
scrollRangeToVisible programmatically.
_______________________________________________
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.