Friday, March 26, 2010

Drag&Drop in a Text Box

My requirement is as follows,

a) Drag a PMString from my palette and to drop it on a text box.

b) Dropped text should be inserted at the point where it has been dropped within the text frame.

c) Also need to do drag tracking within the text box i.e., Similiar to InDesign behavior when you drag text from another application and drop it on a text box (a cursor tracks the drop location), the drag text is inserted at the drop location.

So far, I am able to drop a text in a text frame and add it at the end of the story, so couldn't achieved the task b %26amp;c.

Some of the code snippet is as follows,

Class
{
kXXXXXXXXFlavorHelperBoss,
kInvalidClass,
{
IID_IK2SERVICEPROVIDER, kLayoutDDTargHelperProviderImpl,
IID_IDRAGDROPTARGETFLAVORHELPER, kXXXXXXXXXDNDFlavorHelperImpl,
}
},

In kXXXXXXXXXDNDFlavorHelperImpl class method, ProcessDragDropCommand?(?IDragDropTarget *?,?IDragDropController *?,?
?DragDrop::eCommandType ), I can easily get the UIDRef of text box and then able to add the dropped text it at the end of story.

Is there any way by which I can transform dropped location PMPoint into the text index ? If this can be possible then it will be easy to insert the text at the dropped location.

Any help will be appreciable.


No comments:

Post a Comment