Re: Mouse button down?
Re: Mouse button down?
- Subject: Re: Mouse button down?
- From: Sam McCandlish <email@hidden>
- Date: Sat, 3 Apr 2004 17:19:44 -0500
On Apr 3, 2004, at 4:56 PM, mmalcolm crawford wrote:
On Apr 3, 2004, at 12:24 PM, Peter Wollschlaeger wrote:
you should override in a custom view mouseDown like:
- (void)mouseDown:(NSEvent *)theEvent
{
NSPoint p = [theEvent locationInWindow];
p.x -= [self frame].origin.x;
p.y -= [self frame].origin.y;
}
If this code is intended to get the point's location in your own
coordinate space, in the general case it is incorrect. You should
use:
- (void)mouseDown:(NSEvent *)theEvent
{
NSPoint p = [theEvent locationInWindow];
p = [self convertPoint:p fromView:nil];
}
Thanks all, but what I actually wanted was to, at any point in time,
whether the app is active or inactive, and whether or not the the mouse
is in "my" window, test to see if the mouse button is down. I need to
do this because I don't want a specific action to happen (which should
happen whenever the mouse is up) to happen when the mouse is down.
Thanks anyways,
Sam
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.