Re: Scroll position of a NSTextView
Re: Scroll position of a NSTextView
- Subject: Re: Scroll position of a NSTextView
- From: Nils Hjelte <email@hidden>
- Date: Thu, 4 Sep 2003 00:15:32 +0200
Actually, it has a position. floatvalue is 0.0 if at top and 1.0 if at
bottom, no matter the size of the knob. I use this myself and it works
perfectly.
From the cocoa documentation on NSScroller:
----------------------------------------
Commonly Used Methods
hitPart
Indicates where the user clicked the NSScroller.
floatValue (NSControl)
Returns the position of the NSScrollers knob.
setFloatValue:knobProportion:
Sets the position and size of the NSScrollers knob.
------------------------------------------------------
// Nils Hjelte
On onsdag, sep 3, 2003, at 21:02 Europe/Stockholm, Neil Earnshaw wrote:
Thought this was a simple question to start with...
It looks like a scroll bar doesn't have a position because it
represents a range, not a precise location like an NSSlider does.
You can use -knobProportion to find to out what proportion of the slot
the knob fills.
You can use -rectForPart:NSScrollerKnob and
-rectForPart:NSScrollerKnobSlot to get the rects that the knob and its
slot occupy, then do some maths.
An NSTextView is in an NSClipView is in an NSScrollView. You can use
-superview to get to the scroll view then use -documentVisibleRect to
find out what part of the text is visible.
Hope this helps,
-Neil
Hi everyone,
How can I get the scroll-bar position os a NSTextView?
P.
_______________________________________________
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.
Neil Earnshaw
Consultant Software Engineer
Object Software Engineers Ltd
email@hidden
Tel : 01747 854 852
Mbl : 07870 209 102
_______________________________________________
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.
_______________________________________________
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.