General XMetaL Discussion
lqian May 1, 2009 at 6:24 am
when will On_Document_After_DropText event be triggered?May 1, 2009 at 6:24 amParticipants 0Replies 1Last Activity 13 years, 9 months ago
Could anybody please tell me when On_Document_After_DropText event will be triggered?
I need to assign new Id for the pasted node(s) if the Id already existed in the document. My application uses range.PasteStringWithInterpret method to paste the content into the document from its own cache which contains the clipboard content.
It seems PasteStringWithInterpret not triggered the On_Document_After_DropText event, or I missed out something.
LingDerek Read May 1, 2009 at 5:41 pm
Reply to: when will On_Document_After_DropText event be triggered?May 1, 2009 at 5:41 pm
The following macro inside journalist.mcr works for me in both XMetaL Author 5.1.1.017 and 184.108.40.206:
With this macro in place, pasting any text into the document results in that text being pasted followed by the string “PasteStringWithInterpret from inside On_Document_After_DropText”. Dragging and dropping text works as well (with or without the Ctrl key held down).
Perhaps you have some other scripts that are interfering or altering the standard behaviour, like the AcceptDropFormat API.
Note that On_Document_After_DropText should not fire if the paste operation fails (this would be the case if what is pasted would put the document into an invalid state). Depending on what you are trying to do you might want to use On_Document_Before_DropText instead to manipulate the content being pasted before it is pasted in. One use for this is to correct any invalid XML before it gets inserted.
Also note that these events do not run in PlainText view.
- You must be logged in to reply to this topic.