Re: How Do I Flip An NSScrollView?
Re: How Do I Flip An NSScrollView?
- Subject: Re: How Do I Flip An NSScrollView?
- From: Dan Saul <email@hidden>
- Date: Fri, 7 Jan 2005 10:09:40 -0600
Ah perfect, this solves all the problems I was having and also saves
me from converting the point on my own, and yes it does work in a
scroll view :-).
I do think I will post this to CocoaDev or another site full of FAQs
so that it will be easier for others to find a solution to this
problem.
On Wed, 5 Jan 2005 22:06:49 -0800, David Jeffery
<email@hidden> wrote:
>
> 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