Skip to main content
Known Participant
February 22, 2007
Question

How to drop the dragged image to a already existing non selected frame?

  • February 22, 2007
  • 9 replies
  • 804 views
Hello All,

My requirement is
I am dragging a image from a listBox entry to indesign document.
So while dropping ,if the mouse is over in image ,then I want the image to be placed inside the frame below the mouse pointer.(the frame is in not selected mode)
and if there is no frame under the mouse location while dropping, i want to create new graphics frame with default dimension and place the frame inside that.

How to do that?
I worked out the Drag functionality but this dropping functionality is giving me nighmares..

Any help is highly appreciated.

Thanks and Regards,
Yopangjo
This topic has been closed for replies.

9 replies

Known Participant
February 27, 2007
found the error...
I didn't change the
#define customFlavor PMFlavor('AOL1')

When I changed it to AOL2 in my plugin..its calling the correct function..

Thanks for all your help..

Regards,
Yopangjo
Known Participant
February 27, 2007
Participating Frequently
February 27, 2007
I have both BasicDragDrop and my Plugin working with the same copy of InDesign.

Please verify the issue, it should be because of some other reason.

Make sure you are using a unique DragFlavor.

Regards
- Amit Gupta
www.metadesignsolutions.com
Known Participant
February 27, 2007
Hi ,
I did the way Amit suggested and it is working fine.But there is still one more issue left.

Both the BasicDragDrop and my own plugin provide the IID_IK2SERVICEPROVIDER, kLayoutDDTargHelperProviderImpl

So I can use my implementation for this only when I delete the BasicDragDrop pluign.
This is certainly a serious limitation as there might be some other plugin which does the same thing and I may not be knowing about that..
So pls tell me how to resolve this issue?

regards,
Yopangjo
Known Participant
February 26, 2007
Thanks a ton Amit..it worked..
Now i have this jealous question..how did you manage to arrive at this solution without any direct support from the SDK ?? :)

You must be a genuis..

Thanks a lot once again..

cheers,
Yopangjo
Participating Frequently
February 26, 2007
Hi Yopangjo,<br /><br />You need to make your own boss class to accept Drop's of your Flavor <br /><br /> Class<br /> {<br /> kXXXMyLayoutDropFlavorBoss,<br /> kInvalidClass,<br /> {<br /> IID_IK2SERVICEPROVIDER, kLayoutDDTargHelperProviderImpl,<br /> IID_IDRAGDROPTARGETFLAVORHELPER, kXXXMyLayoutDropFlavorImpl, //override CDragDropTargetFlavorHelper just like BasicDnD sample<br /> }<br /> },<br /><br />Then u can use the following code in ProcessDragDropCommand function for calculating the PageItem for the drop location<br /><br />MyClass::ProcessDragDropCommand(IDragDropTarget* ptrTarget, <br /> IDragDropController* ptrController, DragDrop::eCommandType action)<br />{<br />InterfacePtr<IControlView> ptrCntlView( ptrTarget, IID_ICONTROLVIEW);<br /><br />PBPMPoint ptMouseLoc = Utils<ILayoutUIUtils>()->ComputePasteboardPoint(ptrController->GetDragMouseLocation(), ptrCntlView);<br /><br />InterfacePtr<ILayoutControlViewHelper> ptrLayoutCntlViewHlpr(ptrCntlView,IID_ILAYOUTCONTROLVIEWHELPER);<br />if (ptrLayoutCntlViewHlpr) <br />{<br />InterfacePtr<IPMUnknown> Temp(ptrLayoutCntlViewHlpr->QueryHitTestPageItemNew(ptMouseLoc , kDirSelNoGuidesHitTestHandlerBoss));<br /> if (Temp)<br /> UIDRef OnDropPageItem = ::GetUIDRef(Temp);<br />}<br />}<br /><br />I hope this help's<br /><br />Regards<br />- Amit Gupta<br />www.metadesignsolutions.com
Known Participant
February 26, 2007
Thanks both amit and pardal..
But I am still clueless about how to go further.
How can I catch the drop event..?
As in case of basicDragDrop sample plugin the panel itself was catching the drop event by aggregating the IDragDropTarget interface.But here where can I aggregate the above interface?

Please help me as I am terribly stucked..

regards,
Yopangjo
Participating Frequently
February 26, 2007
Hi Yopangjo,

You don't need to iterate through the boxes, instead to this consider using ILayoutControlViewHelper interface.

It has two functions which performs hittest for you.

Best Regards
- Amit Gupta
www.metadesignsolutions.com
pardalek
Inspiring
February 26, 2007
Hi yopangjo,

I did it this way:

1) drop occurred, remember the location
2) iterate through the page items and find the items in which the drop point is located.
3) choose the appropriate item (for ex z-buffer, your own preference).
4) you got the frame, now you just need to replace the image or whatever.

If you find this interesting and helpful, let me know, we can discuss more.

Pardal