Re: Cocoa autoscroll question
Re: Cocoa autoscroll question
- Subject: Re: Cocoa autoscroll question
- From: Mark Dawson <email@hidden>
- Date: Mon, 28 Feb 2005 22:09:13 -0800
I couldn't get this to work--maybe I'm misunderstanding something or am starting from a different position: I already have a view in my window that is a subview of a scroller (and I only want one scroller, I believe). Doing step #3 creates a 2nd scroller.
Also, if my present view is larger than the scroller (which is common, then this means that the "autoscrolling region" overlaps that view; is that desirable?
It almost seems like I should add a method to my existing -mouseDown routine that checks to see if the mouse is within a few pixels (or some distance) of the scroller, and if so, does the autoscroller calls.
Mark
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
_______________________________________________
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