Re: Getting current mouse position after scroll
Re: Getting current mouse position after scroll
- Subject: Re: Getting current mouse position after scroll
- From: Dave Fernandes <email@hidden>
- Date: Sat, 11 Dec 2010 20:25:23 -0500
Well, to answer my own question, you get cursorUpdate events when scrolling on Snow Leopard, but apparently not on Leopard.
On 2010-12-04, at 2:10 AM, Dave Fernandes wrote:
> I'm just playing with this myself, and when using an NSTrackingArea, I find I get cursorUpdate: events when scrolling. This event provides the mouse location just like mouseMoved:. Based on the sparse description for cursorUpdate:, however, I can't tell whether I can count on this behavior. Can anyone else confirm?
>
> Thanks,
> Dave
>
> On 2010-12-01, at 10:42 PM, Graham Cox wrote:
>
>>
>> On 02/12/2010, at 2:19 PM, Rick Mann wrote:
>>
>>> I have a view that shows the coordinates of the current mouse location in it. I update this via -mouseMoved: But if the user scrolls the view with a scroll ball, I don't get mouse moved events.
>>>
>>> 1) What's the best way to react to scroll changes? I'm currently observing the NSViewBoundsDidChangeNotification.
>>>
>>> 2) How can I get the mouse position at this point? I don't have an NSEvent to check.
>>
>>
>> Scrolling might occur for some reason other than an event, such as a timer when autoscrolling, so listening for a bounds change is probably the right approach, assuming it is triggered for a scroll. Otherwise you may have to resort to polling for a change in the frame origin.
>>
>> You can get the mouse position using [NSWindow mouseLocationOutsideOfEventStream]
>>
>> --Graham
>>
>>
>> _______________________________________________
>>
>> 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
>
> _______________________________________________
>
> 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
_______________________________________________
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