Highlighting object during external drag

Hi All,

I am trying to do an external drag of an object onto a diagram, and intend to replace an object if I drop on top of it. I want to highlight the current object on the diagram, so the user knows what will be replaced if he releases the mouse. Whilst I can use OnEnterLeave() when internal dragging to highlight objects, this doesn’t work for external drag.

Now I guess I could keep track in my override of DoExternalDrag() of each item as I encounter and highlight it, and then unhighlight any previous one, but this seems very clumsy.

There must be a better way?


In the User Guide, read through the sub-section called External drag and drop in GoDiagram Win under the Drag-and-Drop, Moving and Copying section.

The last paragraph:

Normally an external drag-and-drop will not raise GoView.ObjectEnterLeave events. However, if the drop would create GoObjects that could be dragged around, you can set GoView.ExternalDragDropsOnEnter and GoView.DragsRealtime to true. This will cause an external drag enter to actually perform the DoExternalDrop immediately; the resulting selection is then dragged around by the view’s GoToolDragging tool.
I think that gives you what you want.

Hi Jake - thanks but I had tried that and it didn’t make any difference… and in any case, I don’t want a copy of the object I’m dragging as the selection - as I will not be actually dropping it onto the diagram, but changing the state of an existing object using the dragged objects data when the user release the mouse button…

The comments for OnEnterLeave() state it is never called for external drag, only internal - so I think I am looking for an approach to force that to be called with external drags…

OK, so you aren’t doing the typical drag-and-drop of GoObjects.

In this case you’ll need to override one or more methods of GoView: DoExternalDrag, GetExternalDragImage, and DoExternalDrop.

This is demonstrated in the Flowgrammer sample.

Thanks Walter - OK I should be fine using that approach. I just thought there might be a different way I had missed… it’s good to know the “right” way of doing things. Cheers :-)