When dropping shape over connector, shape moves before Document_ShapeAdded fires

Started by ImAPictureFormat, October 09, 2019, 09:32:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ImAPictureFormat

Hello,

I have a template set up with a set of subs and functions that I use for creating and managing a tree-like structure. I have a Document_ShapeAdded sub that I use to handle whenever I drop a shape onto a page. One of the features that I've implemented is, when the user drops a shape while overlapping another shape, it automatically connects the new shape to the preexisting one and places the new one in an empty spot below the preexisting shape. In doing some testing I noticed that when I hover the new shape such that it is over a connector and the connectors glue points are highlighted, the shape is moved before Document_ShapeAdded is called.

To further illustrate what I'm trying to say, here are some screenshots:
When I hover the new shape over just the intended parent like in the HoverIncorrect.png attachment, the new shape is moved in between the two existing shapes and the connections are changed, like the HoverIncorrectResult.png.

When in fact what I wanted was to place the new shape next to the existing blue shape as a child of the purple shape.

Is there another event that fires in that case that would move the new shape before my handler gets called?

wapperdude

That's a tough scenario to get desired action.  But, it's possible.  For the page properties, turn off connector splitting under layout and routing.
Visio 2019 Pro