Re: NSOutlineView drag and drop problem
Re: NSOutlineView drag and drop problem
- Subject: Re: NSOutlineView drag and drop problem
- From: Tony Romano <email@hidden>
- Date: Fri, 11 Jun 2010 01:03:00 -0700
I guess I don't understand. Validating the drop to me is different then the "type" of drop action. Both in the validate and the accept, the user decides the "type" of drop action(copy/move) . The validate method decides if the user is allowed with the operation which is what is determined by you app and provides the feedback to the user. If the drop is valid, the same operation code will be preset in the accept method unless the user cancels the action(i.e and mask keys are still active or you get the full op code). Factoring into one function the common stuff makes perfect sense.
-Tony
On Jun 10, 2010, at 10:24 PM, Graham Cox wrote:
> Thanks, but this is not the case.
>
> The validateDrop method returns a NSDragOperation value that I compute. That is not the same value that the [<draggingInfo> draggingSourceOperationMask] returns, though that is certainly one of the many inputs I use when working out the validation.
>
> The two methods do much the same work so there's a good opportunity to factor the code as Jens suggests, but locally saving the return value from validation works OK and appears to be all I can do.
>
> --Graham
>
>
>
>
> On 11/06/2010, at 6:27 AM, Tony Romano wrote:
>
>> It does. Making a call to draggingSourceOperationMask in your acceptDrop method will give you the operation that is active. No need to cache it.
>>
>> -Tony
>>
>>
>> On Jun 10, 2010, at 11:12 AM, Jens Alfke wrote:
>>
>>>
>>> On Jun 9, 2010, at 11:12 PM, Graham Cox wrote:
>>>
>>>> In –outlineView:acceptDrop:item:childIndex: I can work out much the same set of conditions as above and mostly do the right thing, but since a move or a copy is equally likely, I need a way to determine what the last drag operation returned during validation actually was. There doesn't seem to be a way to do this by requesting it from any of the parameters passed to that method.
>>>
>>> Well, since acceptDrop takes the same parameters as validateDrop, it seems you should be able to work out the same operation that validateDrop arrived at. I often end up writing a subroutine that takes the dragging info and items and works out the operation and other useful stuff, and then have both of those methods call it.
>
>
_______________________________________________
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