Re: Line/page scrolling an NSScrollView
Re: Line/page scrolling an NSScrollView
- Subject: Re: Line/page scrolling an NSScrollView
- From: Glen Low <email@hidden>
- Date: Sun, 11 Apr 2004 08:09:42 +0800
Allan:
On 11/04/2004, at 12:12 AM, Allan Odgaard wrote:
On 10. Apr 2004, at 12:45, Glen Low wrote:
I'm racking my brains (and the docs) for this one in case I missed
something obvious. If I have an NSScrollView how do I either (a)
programmatically scroll it by exactly one line or one page or (b)
make it respond to the usual keystroke e.g. page down to scroll by
exactly one line or one page?
You'll need to implement the moveUp:/moveDown: action methods in the
embedded view and have these use scrollRectToVisible: or
scrollToPoint:.
That's what I thought. But consider this: the NSScrollView already
*knows* how to scroll by a line, since it does so when you click on the
up-arrow or down-arrow. How do I use that inbuilt functionality? I
could simply setFloatValue with the lineScroll amount, but that only
changes the scroller not the scroll view. Perhaps some kind of
accessibility trick or simulated hit?
As far as page up/down go, it seems to respond to the pageUp or
pageDown method, but no such luck with line up/down.
I am also slightly confused about how things are supposed to work. It
seems the scroll view implements pageUp: and pageDown:, but my default
key bindings has the page up/down keys set to send scrollPageUp: and
scrollPageDown:.
I suppose since scrollPageUp: means "scroll one page up" and pageUp:
means "scroll one page up and also move the cursor up". Thus the
NSScrollView method appears to be some kind of default that's there in
case your content view doesn't handle pageUp: e.g. if it is
non-editable. Strange though that the NSScrollView doesn't implement
any of the scrollxxx methods.
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
_______________________________________________
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.