Correct way to manage drag-delete cursor?
Correct way to manage drag-delete cursor?
- Subject: Correct way to manage drag-delete cursor?
- From: Graham Cox <email@hidden>
- Date: Wed, 7 Apr 2010 22:02:10 +1000
Hi all,
I'm working way too hard to make this work, making me think I've just missed something obvious.
I have a window containing two main views. I can drag items from one of the views into the other view. That all works fine, and is entirely under the control of the drag destination in terms of returning the appropriate drag operation to set the right cursor.
I also want to be able to drag the items off to delete them. Since that is decided by there being no destination, but just a drop outside the window, there is no destination to control the cursor, so I'm trying to use the source instead, by implementing -draggedImage:movedTo:, testing the point against the window's frame, and setting the disappearing item cursor if outside.
The first thing I find is that the point passed is the bottom, left of the image, not the cursor. No biggie, I can get the cursor location directly. The main problem is when the cursor moves back inside the window, it may or may not come under the influence of the destination view again, so simply forcing it to the arrow is inappropriate. This is where I find myself doing too much work: I'm having to set a flag when I first reset the cursor and clear it again on leaving the window and so on, just to figure out when and when not to touch the cursor. Surely this scenario was anticipated in the drag/drop design? What's the correct way to do this?
--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