DoDragDrop on modified master shapes has strange side-effect

Ã

Ã…ke

The scenario is the following:

I have a tree which I drag shapes from. When dragging the item, i find its
corresponding master in the document stencil (via doc.Masters.get_ItemU) and
DoDragDrop(foundMaster, DragDropEffects.Copy) on the master shape I get.

After doing this a couple of times (and it works as it should) i edit (in
visio) the master shape in the document stencil. After updating all
references i try dragging another one in from my tree. The dragged object
looks fine, but when releasing/dropping the shape on the drawing surface, the
text is renamed to what it was before, and another master is created in the
document stencil.

Why is this happening? My code find the correct master since the text is
correct when dragging the item without releasing it... But Visio does
something when i release it. I know that the UniqueID changes when editing
the text, but should this really be a problem?

If i edit the master in the document stencil before doing any drag-and-drop
operation, then drag-and-drop works (no change of text and no new master
shape), but immediately after editing the master, it starts acting weird!

Dragging the master from the document stencil works fine in every case.


Another thing:
I have also noticed that the icon when my drag-and-drop operation is going
on, is more like in windows explorer, but when using the document stencil
it's only a small 'plus' sign. What is the difference?.. How can I access
Visios internal drag-and-drop functionality?
 
J

JuneTheSecond

Though I do not know the detailed mechnism, Visio knows that you changed
the instance that you have droped from the stencil to your document page.
Visio knows changed master is not equal to the another master that you
have dropped next.
 
Ã

Ã…ke

I suspected that it had to do with the UniqueID changing... It still seems
that there is some caching done which makes Visio reload old information from
the saved stencil instead of taking the edited master.

However: Enabling MatchByName for the master in the document stencil solved
the problem. It now loads the correct master.

Do you know if it matches by 'Name' or 'NameU' (universal name) ?

Thanks for the link to the overview!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top