Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: How Do I Flip An NSScrollView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How Do I Flip An NSScrollView?




On Jan 5, 2005, at 14:27, Dan Saul wrote:

I'm having some difficulties with an NSScrollView (such as the ruler
starts at the bottom of the view) not to mention that I have to
convert all my coordinates.

I can't find anything in the documentation other then an anccessor
that you are supposed to overwrite.

Is there a relatively simple way to do this as it would save me from
lots of code and save me some hairs :-).

Thanks alot,
Dan


Hi, Dan.

First, I should state that I'm not an expert in this stuff. Second, I should state that I *think* I know what you're asking, but I'm not entirely sure I do. What I think you're asking is, "how do I make my scroll view place (0.0, 0,0) at the top-left corner instead of at the bottom-left corner?" If this is correct, then I believe that all you have to do is handle -isFlipped in your NSScrollView subclass, as follows:

- (BOOL)isFlipped
{
	return YES;
}

I think you also need to make sure you translate points and rects correctly, such as something like this:

- (void)mouseDragged: (NSEvent *)theEvent
{
NSPoint pt = [self convertPoint: [theEvent locationInWindow] fromView: nil];
NSLog(@"mouseDragged: (%f, %f)", pt.x, pt.y];
}


I tested this approach out, although with a simple NSView subclass rather than an NSScrollView. If anyone on the list would care to confirm or criticize the correctness/appropriateness of any of this, please do so!

David

_______________________________________________
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


References: 
 >How Do I Flip An NSScrollView? (From: Dan Saul <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.