Is there a shapesheet function that does what VBA's Shape.XYToPage does for grouped shapes, to get the coordinates on the page rather than within the group?
See: https://docs.microsoft.com/en-us/office/vba/api/visio.shape.xytopage
The top-level shape of the group's PinX/Piny give you the shape's page coordinates.
Is that any use?
Yes of course so simple can just refer to those values with subshape user row formula thank you Paul!
Another use case Paul is to detect whether the user has grouped a shape (so I don't know the ID of the group shape that the shape has become a subshape of).
Would something like LOCTOPAR do what I need in this case, to get the X and Y values in page coordinates?
https://docs.microsoft.com/en-us/office/client-developer/visio/loctopar-function?redirectedfrom=MSDN
I'm assuming that the page. coordinates for the sub are merely for reference info. You might get that info for the sub using the loctopar fcn, using the page as the pseudo parent. That way, no worries re parent shape ID.
Specifically, this formula works: =LOTOLOC(PNT(LocPinX,LocPinY),Width,ThePage!PageWidth). Simple Google of Shapesheet functions gets you to this formula.
Thank you wapperdude this is a very useful function, I think I could create a 'detector' that detects if a user is grouping my special shapes:
1. Add to user row: =LOTOLOC(PNT(LocPinX,LocPinY),Width,ThePage!PageWidth)
2. Compare values to shape's own cell, if they differ then fire QUEUEMARKEREVENT
3. Check whether shape has become part of a group of shapes, give user warning message and undo the group
I could listen for the event of a user grouping shapes as well of course, but then my sub/function will fire when any shape is grouped, now I get a notice only when specific shapes are fired.
Is there a shapesheet function that allows me to compare points to check if they're equal.
If I try:
IF(PNT(PinX,PinY)=User.Row_2,"Shape is ungrouped","Shape is grouped")
and User.Row2 contains:
=LOCTOLOC(PNT(LocPinX,LocPinY),Width,ThePage!PageWidth)
I always get the answer true back, even though the points are not the same when the shape is grouped (if I compare to PNT(0,0) I still get true regardless of the shape's position).
Seems I need another shapesheet function to perform this comparison, hopefully there is one!
You may have to parse the point into its x- & y- values, and then compare x to x & y to y. Chexk PntX and PntY functions.
Thank you Wapperdude that works well:
In User.Row_2:
=LOCTOLOC(PNT(LocPinX,LocPinY),Width,ThePage!PageWidth)
Then in User.IfTrueUserHasNotPutThisShapeInAGroup
=AND(PinX=PNTX(User.Row_2),PinY=PNTY(User.Row_2))
This formula will be TRUE is the shape is not in a group, FALSE if the user has grouped the shape into a new group.
-> the edge condition would be if the group starts exactly where the page starts, but I'll take that possibility for granted won't cause issues.
(the shape itself can be a group, but this is for checking if the user has put this (group) shape in another group).
That has to be the longest row name I've ever seen! ;D. But, you'll always know why it's there. ;)
Glad it's working for you.