Export (0) Print
Expand All

PreDrag method

Called by MSHTML before an ondragstart event fires on a selected element in the editor, and before the element is cloned prior to a drag-and-drop operation.

Syntax


HRESULT retVal = object.PreDrag();

Parameters

This method has no parameters.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

When the user performs a drag-and-drop operation on an element in the MSHTML Editor, Windows Internet Explorer clones the element, and then temporarily deletes the element from the document tree. The cloned element is pasted back into the tree in its new location when the user drops the element. By implementing this method, an Editor host can intercept the drag-and-drop operation before the element is cloned and deleted.

For example, suppose that the cloned element created by a drag-and-drop operation has a new IHTMLDocument3::uniqueID that differs from the IHTMLDocument3::uniqueID of the original element. An application that uses the IHTMLDocument3::uniqueID for tracking must map the IHTMLDocument3::uniqueID of the original element to the IHTMLDocument3::uniqueID of the cloned element. Because the call to IHTMLEditHost2::PreDrag occurs before the element is cloned and deleted, an implementation of IHTMLEditHost2::PreDrag can store the old IHTMLDocument3::uniqueID before the drag begins, possibly with an expando property on the element. After the drag is complete, the application can use the expando to update the old element IHTMLDocument3::uniqueID to the new IHTMLDocument3::uniqueID and then delete the expando.

 

 

Show:
© 2014 Microsoft