Change a Shape's Image

Started by Chimpsky, February 22, 2013, 12:13:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chimpsky

Hi There,
I have a couple images of a product (front and back). I'd like to have both images within the same shape. Users could right-click the shape and select either front or back to toggle the shape's image. Does anyone have any ideas of how this could be done?

I found a shape that supports this behavior and I have done my best to reverse engineer the shape, but I cant seem to figure out how they're providing the functionality. There is a variable list (prop.row_3) within the shape's data that calls out either front or back, and there are two action rows within the shapesheet (front and back). Example of front:

action: SETF(GetRef(Prop.Row_3),""""&Actions.Row_1&"""")   
menu: "Front"
tagname: ""
buttonface: ""
sortkey: ""
checked: STRSAME(Prop.Row_3,Actions.Row_1)
disabled: 0
readonly: FALSE
invisible: FALSE
begingroup: FALSE

How can I associate a different image with each state?
Thanks,

Jumpy

I would guess the shape is a group of 2 Subshapes. Each of the Subshapes is/has on picture.
The ShapeData you found is in the group and it toggels wether the Action item (=RightClickMenu) is checked or not.
Without knowing the shape I would guess that there are formulas in the shapesheet of the subshapes that look if the action is checked or not and become visible or not.

wapperdude

Adding to Jumpy's reply, one technique that is used with pictures takes advantage of the z-order.  That is, the front picture will either hide or show the picture behind it.  Thus, you only need to control the visibility of the front picture.  But, it could just as easily be applied to both shapes.  It is based upon a technique from David Parker. The hide / show action of the menu sets a parameter, could be in the user section  of the shapesheet, to either "1" or "0".  This value is pushed into the shapesheet of the front picture, in the Foreign Image Info section and is used as a multiplier in the image width and length cells.  You should (could) see a formula in those cells, something like Width*1*Sheet.1!User.ShowFront.  Sheet.1 is the top level, group shape.  Thus, the hide action would set the user.showfront to zero, and would collapse the front shape, showing the back shape.

HTH
Wapperdude
Visio 2019 Pro

vojo

yep....dont mess with Docmds to bring forward or push to back....those only work if the subshape is actually selected.