Please find attached the example Wapperdude.
I am using this example to demonstrate how using action cells solve a key issue.
Because I use a Visio add-in (written in VB.NET in preparation for the AMAZING TwinBasic.com!), for this example you need to turn on Visio Event Viewer to see what is going on.
Use case:
1. I use a lot of code for (automatically) adding and changing shapes, which means in some cases when I fire a MarkerEvent (with QUEUEMARKEREVENT on the shapesheet), the shape selection has moved on and I am not sure if the shape in the selection is actually the shape that fired off the event! (leading to errors).
2. That is why I want to add the string from the shape ID() function to the string that QUEUEMARKEREVENT adds to the event, to make sure I identify the right shape that has fired the event.
(I now also have a way of making sure I get the right page and document the shape is on, to be absolutely sure I know which shape fired the event, but is beyond this example -> I think making absolutely sure which shape fired the MarkerEvent is critical for software reliability, but I may be overly cautious)
3. But for firing off MarkerEvents when shape data changes, if I create a QUEUEMARKEREVENT + DEPENDSON in a user cell, and it contains an ID() field, the MarkerEvent also fires if you drop the shape on the stencil. There may be more than 10 of such cells in the shape, meaning a shape drop results in many markerevents firing that shouldn't.
4. By putting the QUEUEMARKEREVENT in an Action cell (with no menu string "" so invisible to the user), then firing this cell with EVALCELL() + DEPENDSON() in a user cell, I do get MarkerEvents when users change shape data, but not when the shape is dropped from a stencil!
I hope the example file is clear:
- There are three identical shapes on the shapesheet. When you double-click on any of them, you get the Shape Data with the ColorSetting dropdown.
- Change the color and press ok, and you will see in Visio Event Viewer that the MarkerEvent has fired from that shape ID and what the color setting is now
- If you drop any of these shapes in a stencil, then drop them back on to the page, you will see MarkerEvent does not fire and my problem is solved with this solution!
So John Goldsmith's article (and the feedback in this forum) has really solved a tough issue for me, thank you!
https://visualsignals.typepad.co.uk/vislog/2018/03/action-cell-execution-in-visio.html