Re: NSCursor tracking areas
Re: NSCursor tracking areas
- Subject: Re: NSCursor tracking areas
- From: Cody Garvin <email@hidden>
- Date: Thu, 24 Jul 2014 14:35:59 -0700
> On Jul 24, 2014, at 1:51 PM, Markus Spoettl <email@hidden> wrote:
>
> On 24/07/14 15:37, Cody Garvin wrote:
>> I then use cusrorUpdate:(NSEvent *)theEvent to change the cursor by iterating
>> over theEvent’s converted point to the view and matching it with a drag point
>> (I do this because in the future the object itself will use another cursor
>> for dragging it around. Then use [[NSCursor pointingHandCursor] set].
>
> It's not clear to me if you have 4 tracking areas that cover only the drag-handles, or if the tracking area(s) cover more than the handle. If they cover the handles, they should "just work" using -cursorUpdate:. You may need an additional tracking area covering your entire view to reset the cursor when the cursor leaves a handle area. There may also be tricky interactions when dragging a handle, since you will have to update the tracking areas to match your handle locations.
>
> What I usually do in situations with multiple different interactive areas in a single view is use one big tracking area covering the entire view and handle cursor changes in -cursorUpdate: AND -mouseMoved: when and if the cursor enters or leaves appropriate areas within my view. No problem handling both, I imagine setting a cursor in -mouseEntered: will not be a problem either.
>
> Also you do NOT need to take care of updating the cursor when it leaves your view, OSX will do that (actually the view that is being entered might).
>
> Regards
> Markus
> --
> __________________________________________
> Markus Spoettl
Thanks for the reply Markus
Currently there is 4 NSTrackingAreas, one over each drag handle. I had one for the main object itself since it can be moved, but removed that in attempts to debug the issue. Resetting hasn’t been an issue, it seems just getting it to trigger has been the issue. The drag handles are 12pt x 12pt. Went bigger to see if that would help.
This is on a static object that hasn’t yet been moved or resized. Seems to be very random, works about 2-3 times out of 4 attempts.
I think I’ll try your’s and Edward’s suggestion on attempt mouseEntered / mouseMoved with a single tracking area. I feel I copied an example from Apple’s docs almost verbatim and was still getting iffy results. Again, I am building on 10.10 for 10.10, so maybe there is something there. It seems like a very straight forward attempt.
I’ll reply with results, most likely tomorrow because I’m working on another feature right now.
Thanks so much for everyone’s help today
- Cody
_______________________________________________
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