newbie view help understanding (rulers example)
newbie view help understanding (rulers example)
- Subject: newbie view help understanding (rulers example)
- From: Mark Dawson <email@hidden>
- Date: Wed, 5 Jan 2005 19:52:08 -0800
In the rulers example (XCode 1.5/Panther Developer CD AppKit sample code), I'm trying to understand how the zooming works.
In the viewRects.m file, the relevant code is (for zooming in, from a menu action):
RectsView custom class, a sub class of NSScrollerView (if I understand things correctly).
NSScrollView *scrollView = [self enclosingScrollView];
oldBounds = [self bounds];
tempRect = [self frame];
tempRect.size.width = ZOOMINFACTOR * NSWidth(tempRect);
tempRect.size.height = ZOOMINFACTOR * NSHeight(tempRect);
[self setFrame:tempRect];
[self setBoundsSize:oldBounds.size];
[self setBoundsOrigin:oldBounds.origin];
What is the difference between "bounds" and "frame" for Cocoa? It appears from the above code snippet that setting the frame sets the bounds, so it needs to be reset? From the documentation, it seems that the bounds is more often acted upon, such as for transformations?
While I see the subview notifying its superview (NSScrollView) to update, I don't see how the above code changes the superview any. I assume that the scroller notifies the ruler that it needs to update, which is handled by Cocoa.
Thanks for any illumination on this!
mark
_______________________________________________
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