Re: NSEvent locationInWindow undefined for non-mouse events, how to catch?
Re: NSEvent locationInWindow undefined for non-mouse events, how to catch?
- Subject: Re: NSEvent locationInWindow undefined for non-mouse events, how to catch?
- From: Kyle Sluder <email@hidden>
- Date: Tue, 14 Feb 2012 21:08:38 -0800
On Feb 14, 2012, at 8:18 PM, Jim McGowan <email@hidden> wrote:
> On 15 Feb, 2012, at 1:18 , email@hidden wrote:
>
>> I've just been bitten by this. Seems it would be easy to detect at runtime and assert, is there any magic environment variable or defaults value that can help me catch such incorrect usage? I've searched but not found...
>
> Are you calling -type on the events you are receiving? Checking that value should make it clear whether the event you have received is a mouse event or not. If not, and you need the mouse location, you can get if from NSEvent's +mouseLocation or a relevant window instance's -mouseLocationOutsideOfEventStream.
The question is whether any debugging code can be added to catch instances where -type isn't being called before asking for the mouse location.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden