How to determine shape underneath another shape

Started by doone, May 25, 2018, 03:58:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

doone

Hi Everyone,

I'm interested to know if it is possible to determine what, if any, shapes are underneath another specific shape on a page.  So, for example, let's say I place a line (sheet.1) on the page and then I place a circle (sheet.2) on top of the line.  Is there a formula that I can put in the shapesheet of the circle to get the name of the line underneath?

Something similar was asked in this post http://visguy.com/vgforum/index.php?topic=1119.msg4867#msg4867.  Paul suggested using SpatialSearch method, but that would be a vba solution.  I'm trying to avoid code and just use the shapesheet.

Kind Regards,
Lorna

vojo

there is a docmd (google it) that allows you to take selected shape and move it to back or front.  No VBA
could use some action cells to do that

or can do manually

AnotherNoOne

Just sharing a weird idea: How about checking for x/y coordinates of the other shape...

This wont work for 2 random shapes, but for soecific shapes wich you previously created it might.
Another_Noone

Just some weirdo on the Interwebs.

vojo

novice approach

- select the line (either .1 or .2)
- color it (say red)
- send to back
- deselect (select something else)
- select the line (still be black)
- color it (say blue)
- now you can tell visually who is on top

If you don't want to change colors then up shape sheet and look for .1 vs .2....rest of the steps same

Journey approach
- put each line on a different layer
- turn layers on and off for specific shapes

Yacine

Actually the answer is: No, there's no shapesheet solution for finding overlapping shapes.
VBA is the way to go.

There could probably be a way where each shape registers its coordinates in a central place (eg the shapesheet of the page) and a clever formula would then check if two coordinates are close to each other. But this would require that each shape is prepared to send this information to the page. This is certainly not what you're looking for.
Yacine

vojo

well...not quite true

you can do this

Action cell =   setf(getref(action.checked), if (action.checked,0,1))

user cell = if (action.checked, docmd(1046),)    Brings to front
or
user cell = if (action.checked, docmd(1048),)    sends it to the back

Basically, thru action cells, you can move the shape to front or send to back

Docmd has a lot of power....probably 200 commands in there.   My favorite is docmd(1312) which opens shape properties

wapperdude

Both Yacine and Go no are arguably correct.

There is no shape sheet function that is equivalent to vba spatial neighborhood that will give you the identity of shapes beneath a given shape.  Even Vojo's approach won't do that.

But, using Vojo's technique, it is possible to change the z-order of shapes and thus reveal by user observation if a shape might have been hidden by another.  This approach requires setting up each shape to have the described actions.  That alone is a lot of work. 

I believe using code is truly the most efficient and satisfying approach.  But, if code is out of the question, then, Vojo's approach is an alternative to consider.

Wapperdude
Visio 2019 Pro

vojo

wapperdude....fair enough...I thought he wanted to see if underneath...not do something algorithmically

wapperdude

@Vojo:  intent wasn't clear...besides, providing options is a good thing.

3rd possible option...assumes this is for newly dropped shapes, you can set Page properties to move existing shapes out of the way when new shape is dropped.  Doesn't help for existing over-played shapes, or even intentionally over-laying to hide a shape.

Wapperdude
Visio 2019 Pro