• 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: mousedown in a view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mousedown in a view


  • Subject: Re: mousedown in a view
  • From: Ryan Britton <email@hidden>
  • Date: Tue, 6 Sep 2005 19:34:03 -0700

Unless your view is positioned perfectly in the window, you'll need to convert loc into view coordinates. Use loc = [self convertPoint: [theEvent locationInWindow] fromView:nil]


On Sep 6, 2005, at 6:43 PM, Jeff Childers wrote:

the view appears to not be aligning with the tracking rect.

mouse x: 21.000000 y: 435.000000 height: 414.000000 width: 96.000000

mouse x: 21.000000 y: 23.000000 height: 414.000000 width: 96.000000

mouse x: 115.000000 y: 67.000000 height :414.000000 width: 96.000000

21 pixels hidden under left side
21 extra pixels on top edge of view and the tracking rect
29 pixels hidden on the right
23 pixels hidden on the bottom

when I draw in the view everything matches up

view size 96w 414h

- (void)mouseDown:(NSEvent *)theEvent
{
    NSPoint loc = [theEvent locationInWindow];
    loc.x -= [self frame].origin.x;
    loc.y -= [self frame].origin.y;

NSLog(@"mouse x: %f y: %f height: %f width: %f", loc.x,loc.y, [self frame].size.height,[self frame].size.width);

}

after some experimenting when I make subview of scrollview and set the scrollers to small and horizonal off is when things become misaligned
how can I fix this?


_______________________________________________
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


_______________________________________________ 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: 
 >mousedown in a view (From: Jeff Childers <email@hidden>)

  • Prev by Date: mousedown in a view
  • Next by Date: Re: mousedown in a view
  • Previous by thread: mousedown in a view
  • Next by thread: Re: mousedown in a view
  • Index(es):
    • Date
    • Thread