Re: Cocoa autoscroll question
Re: Cocoa autoscroll question
- Subject: Re: Cocoa autoscroll question
- From: Jeremy French <email@hidden>
- Date: Sun, 27 Feb 2005 15:07:44 -0500
TO SET UP THE "AUTOMATIC SCROLLING REGION"
----
Create a subclass of NSView, perhaps named "MyView". Import the class into Interface Builder, and then do the following:
1) Drag a "custom view" onto the window.
2) Select the "custom view", and change its class to MyView.
3) With the MyView instance selected, choose LAYOUT -> MAKE SUBVIEW OF - SCROLL VIEW.
4) Select the scroll view, and position accordingly. Also set its automatic resizing.
5) Double click on the NSScrollView until you select MyView.
6) Using the InfoPanel, make MyView's dimensions greater than the scroll view.
You should now be able to scroll MyView.
TO PROGRAM THE AUTO SCROLLING FUNCTIONALITY
---
In the "mouseDown:" method implemented in MyView, add the following line:
[[self superview] autoscroll:event];
where event is the NSEvent parameter passed to the mouseDown method.
SOME DOCUMENTATION
---
The book "Cocoa Programming for Mac OSX (second edition)" by Aaron Hillegrass has several chapters on this. See chapters 14 and 15.
---
On Feb 26, 2005, at 5:34 PM, Mark Dawson wrote:
I see that I can program NSView's autoscroll: to allow automatic scrolling when the user hits the "automatic scrolling region". However, I wasn't clear how to do that.
(1) How do I set up the "automatic scrolling region" and
(2) How do program the auto scrolling functionality?
I didn't see much documentation other than references that it could be done.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden