Re: How can I tell that a view has scrolled?
Re: How can I tell that a view has scrolled?
- Subject: Re: How can I tell that a view has scrolled?
- From: Ivan Kourtev <email@hidden>
- Date: Sat, 17 Apr 2004 10:33:05 -0400
On Apr 17, 2004, at 12:45 AM, Allan Odgaard wrote:
On 17. Apr 2004, at 5:27, Ivan Kourtev wrote:
I suppose drawRect will get sent after scrolling but that's too
unreliable because I need to know that the user has scrolled and
where for purposes other than drawing.
May I ask which?
Well, I have an application with a _main_ window where the user does
things. The user is able to zoom in/out and scroll around a rather
large work area displayed in a _main_ view inside the _main_ window.
Similar to Illustrator, I'd like to have a separate _navigator_ window
and display in it a miniature schematic representation of the _main_
view outline and and relative position and size of the viewable area
defined by the zoom factor and the current scroll position.
So the question is, when the user scrolls, how does the _main_ view
know so that it can tell the _navigator_ about the change? Right now I
am updating the navigator from within drawRect iof the _main_ view but
I have a bad feeling some of these calls are useless (like a view can
get a drawRect message because a part of it that was obscured has
become exposed, right? no scrolling here, so why bother sending old
info to the navigator?)
Does a scroll view tell its enclosed views that scrolling has
occurred in any way other than marking them for redrawing? any help
appreciated, thanks.
I think the NSClipView sends translateOriginToPoint: to your view.
This can be overloaded, but also generates a
NSViewBoundsDidChangeNotification. I do not know of a documented way
to intercept the scroll.
I can put buttons around the _main_ view and only allow scrolling
through these buttons which I control programmatically and know exactly
when has it occurred. But that is not elegant enough.
_______________________________________________
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.