> In a similar situation, I didn't subclass NSScrollView. I subclassed NSView 
> and inserted an NSScroller directly as its subview. I tracked the position 
> with a 64-bit variable which I converted to a range suitable for the 
> NSScroller just for setting its thumb position and size. I set my view as the 
> NSScroller's target to convert back to my 64-bit position.
> 
> In the subclass' -drawRect: method, I calculated the visible portion of the 
> view, and simply drew that - no NSClipView required. For your case, you'd 
> have an additional step involving the scale; be careful with loss of 
> precision there.
> 
> Despite being somewhat more work to implement, this proved to be more 
> efficient and also a good learning experience regarding the view drawing 
> mechanism.

One unfortunate caveat of this solution is that it’s very difficult to
exactly reproduce some of the behavior of NSScrollView, especially if
you plan to handle dragging or anything else that requires
-autoscroll:ing.

And don’t forget about exposing the proper accessibility roles and
attributes.

-Ben
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to