• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
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?


  • Subject: Re: How Do I Flip An NSScrollView?
  • From: David Jeffery <email@hidden>
  • Date: Wed, 5 Jan 2005 22:06:49 -0800


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


  • Follow-Ups:
    • Re: How Do I Flip An NSScrollView?
      • From: Dan Saul <email@hidden>
    • Undo logic location?
      • From: Tom Davies <email@hidden>
References: 
 >How Do I Flip An NSScrollView? (From: Dan Saul <email@hidden>)

  • Prev by Date: Re: OT: Database of IP locations?
  • Next by Date: Undo logic location?
  • Previous by thread: How Do I Flip An NSScrollView?
  • Next by thread: Undo logic location?
  • Index(es):
    • Date
    • Thread