Subclass WebView and override the standard NSDraggingDestination methods.

On 28 Oct 2010, at 00:19, Wayne Shao wrote:

> I would like to handle drop to WebView to not load the  dropped object, but
> to perform some customized action.
> However, I ran into similar issues as described here:
> 
> http://lists.apple.com/archives/webkitsdk-dev/2005/May/msg00046.html
> 
> Basically, for these two callbacks in WebUIDelegate,
> 
>   - A. – 
> webView:dragDestinationActionMaskForDraggingInfo:<http://developer.apple.com/library/mac/documentation/Cocoa/Reference/WebKit/Protocols/WebUIDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/webView:dragDestinationActionMaskForDraggingInfo:>
>   -
>   - B. – 
> webView:willPerformDragDestinationAction:forDraggingInfo:<http://developer.apple.com/library/mac/documentation/Cocoa/Reference/WebKit/Protocols/WebUIDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/webView:willPerformDragDestinationAction:forDraggingInfo:>
>   -
> 
> My question is: How can I return something other
> than WebDragDestinationActionLoad in A and still have a chance to process
> the data in method B?
> 
> Currently, the issues are:
> 
> 
>   - If I return WebDragDestinationActionDHTML, B is never called.
>   - If  return WebDragDestinationActionLoad, B is called, but I do not want
>   to load the dropped resource. I want to customize it by extracting data and
>   update the current resource in WebView.
>   - Another option is to do the custom data extraction in A and
>    return WebDragDestinationActionNone. But the callback A is invoked multiple
>   times during a drag/drop operation, I need to only process it once at the
>   last callback.  i.e., the correct place to do it is in callback method B.
> 
> Any solutions?
> 
> Thanks,
> -- 
> W. Shao
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to