• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Override default Drag & Drop behaviour for a Text Box

Contributor ,
Feb 03, 2017 Feb 03, 2017

Copy link to clipboard

Copied

I have a plug-in that is attempting to accept a drag & drop operation from a 3rd party browser based image system.

The drag operation provides a 'TEXT' flavour which contains a URL that I want to process and then make some

changes to the text box that was targeted.

Typically you implement a CDragDropTargetFlavorHelper and override CouldAcceptTypes & ProcessDragDropCommand

DragDrop::TargetResponse

  OrdPnlDDFlavorHelper::CouldAcceptTypes( const IDragDropTarget* target,

  DataObjectIterator* dataIter,const IDragDropSource* fromSource,

  const IDragDropController* controller ) const

{

     ... Some code to Decide that the 'TEXT' flavour is in the Drag preceeds this bit

  DataExchangeResponse response = dataIter->FlavorExistsWithPriorityInAllObjects( 'TEXT' );

  if( response.CanDo() && target->IsTargetModifiable() )

  {

  InterfacePtr<IDragDropController> ddController( GetExecutionContextSession(),IID_IDRAGDROPCONTROLLER );

  ddController->SetTrackingCursorFeedback( CursorSpec( kCrsrPlaceFileInto ) );

  return DragDrop::TargetResponse( DragDrop::kDropWillCopy,

   DragDrop::kUseDefaultTrackingFeedback,

   DragDrop::kUseDefaultCursorFeedback,

   DragDrop::kUseDefaultTargetTracking,

   DragDrop::kOverrideHelper );

   }

  return DragDrop::kWontAcceptTargetResponse;

}

The last parameter if the DragDrop::TargetResponse is interesting here as it defines the behaviour of the FlavorHelper and is of the type PMFlavorPriority

which has a whole host of settings in PMFlavorTypes.h starting at line 132. One of these is kHighestFlavorPriority which I would expect to give our handler top priority and be allowed to accept the drop. No matter what value I pass back for this, the standard InDesign 'TEXT' flavour handler always gets the drop and our ProcessDragDropCommand function is never called.

Has anyone ever successfully modified the default drop behavior on text boxes for the 'TEXT' flavor?

My solution works fine for Picture boxes ( presumably because they don't accept the 'TEXT' flavor ).

Kind Regards,

Mike/

TOPICS
SDK

Views

995

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

Hi,

I seem to be at the place you are. Did you find a solution for this?

P.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

Hi,

Unfortunately not I'm afraid, we ended up having to drop support for this feature in the end.

At the time I believe we were attempting to implement this in CC2015 and also CS5.5 and

to support some legacy installs. I presume this is still broken in CC2019 too?

Regards,

Mike.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

Hi,

I am Mac CC2015 and have got it working with Chrome and FireFox. My problem is with windows. On windows my CouldAccept gets called but ProcessDD doesn't.

This might help you.

I am using:

#define customFlavor kTEXTExternalFlavor

In the CouldAccept

  response = dataIter->FlavorExistsWithPriorityInAllObjects(customFlavor);

  if (response.CanDo())

        {

  return DragDrop::TargetResponse(response, DragDrop::kDropWillCopy);

        }

P.

Edited.

I was using 'Text' flavour, now using 'TEXT' and Safari works too.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

Hi,

Thanks for the heads up, will certainly look into it and see if this helps.

Regards,

Mike.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

Did you get Windows working?

P

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 18, 2019 Mar 18, 2019

Copy link to clipboard

Copied

LATEST

It was a mac only install and codebase so windows wasn't used.

Mike.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines