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: Allan Odgaard <email@hidden>
- Date: Sat, 17 Apr 2004 18:20:27 +0200
On 17. Apr 2004, at 16:33, Ivan Kourtev wrote:
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?)
Yes, the view does receive drawRects for other purposes than scrolling.
But they are rare, because the view is double buffered, so e.g. being
obscured by another window does not require a redraw when that window
is moved.
I assume you send visibleRect to the navigator, so that it may serve as
a check to see if scrolling really did happen.
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.
I would try to let the navigator take notify on
NSViewBoundsDidChangeNotification for the view. That way the view also
do not need to know about the navigator, and I am almost certain that
this notification is sent when the user scrolls.
** Cocoa FAQ: <
http://www.alastairs-place.net/cocoa/faq.txt> **
_______________________________________________
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.