re: locationInWindow not valid for key event (as opposed to mouse event)?
re: locationInWindow not valid for key event (as opposed to mouse event)?
- Subject: re: locationInWindow not valid for key event (as opposed to mouse event)?
- From: "Michael B. Johnson" <email@hidden>
- Date: Sun, 6 Jan 2002 17:31:01 -0800
In case my last message wasn't clear enough, here's the code to
reproduce what I'm talking about. Note that the locationInWindow is
always nonsense (and usually the same, no matter where you move the
mouse when you press/release a modifier key), while the mouseDown: one
is fine.
I would expect, from the documentation and header (and because I need
it :-)) that it would be valid in both routines.
Thoughts? I realize it's the day before Steve's talk, so lots of folks
are either sleeping or ignoring email, but...
// put the following in a minimal NSView subclass and click around and
press/release modifier keys:
- (BOOL)acceptsFirstResponder
{
return TRUE;
}
- (void)flagsChanged:(NSEvent *)theEvent
{
NSPoint xy = [theEvent locationInWindow];
NSLog(@"flags changed to %d at %f %f in window %@:",
[theEvent modifierFlags], xy.x, xy.y, [theEvent window]);
return ;
}
- (void)mouseDown:(NSEvent *)theEvent
{
NSPoint xy = [theEvent locationInWindow];
NSLog(@"mouseDown: at %f %f in window %@:", xy.x, xy.y, [theEvent
window]);
return ;
}
--> Michael B. Johnson, Ph.D. -- email@hidden
--> Studio Tools, Pixar Animation Studios
-->
http://xenia.media.mit.edu/~wave