• 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
Problems manually scrolling a view using mouseDown:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems manually scrolling a view using mouseDown:


  • Subject: Problems manually scrolling a view using mouseDown:
  • From: John Fox <email@hidden>
  • Date: Fri, 21 Jan 2005 20:02:07 -0800

Hello:

I have an NSImageView subclass that is contained within an NSScrollView. I'm trying to make it possible to scroll the view by dragging the mouse in the view, but I've run into some problems.

This is what I've tried so far, and it doesn't quite work right. I have these problems:

1) When dragging, my open hand cursor reverts to the arrow cursor.

2) The scrolling doesn't seem to track evenly with the mouse: I'm not sure if I'm translating the mouse location correctly.

Here's the code I have so far. Could some kind soul guide me?

- (void)mouseDown:(NSEvent *)theEvent
{
// Give the user a hand
[[NSCursor openHandCursor] set];
}


(void)mouseDragged:(NSEvent *)theEvent
{
NSPoint myPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];

[self scrollPoint:
myPoint];


[self setNeedsDisplay:YES];
}

- (void)mouseUp:(NSEvent *)theEvent
{
// Back to our standard arrow cursor
[[NSCursor arrowCursor] set];
}

Many thanks,

John

 _______________________________________________
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

  • Prev by Date: Re: [Moderator] Re: Authorization without permanent setuid on helper
  • Next by Date: Re: Authorization without permanent setuid on helper
  • Previous by thread: XML and encoding
  • Next by thread: Re: Problems manually scrolling a view using mouseDown:
  • Index(es):
    • Date
    • Thread