Changing background color when Clicking - Visio 2016

Started by BillyBoy, August 27, 2018, 09:31:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BillyBoy

Hello,

My aim is to switch the background color of several shapes by clicking on another shape. Then when clicking again, every shape comes back to the default color.
Knowing that I use Visio 2016 (and being a beginner with this software), is there a way to manage this task by using the Events or Actions section and then avoiding VBA/JavaScript?
If programming seems to be the most efficient option, I'll go for it.

If the topic has already been mentioned and solved, I would be glad to get redirected to the corresponding thread.

Thank you in advance!

wapperdude

This can  be done with the shapesheet, no VBA needed.  A decision must be made up-front though.  That is, to push the color change into the various shapes or to let each shape pull in the color change.  The first choice requires that the color changing shapes are known, and then get coded into the "decision" shape.  Changes mean editing that shape.  The second method means that each color changing shape checks the decision shape.  The advantage is that any number of shapes can be controlled.  The disadvantage is that each shape must check the decision shape...this is quite easy.

Attached file uses the 2nd method for control.  The decision shape, the square, has two entries.  One is a User defined entry, user.DblClk.  It stores the condition to determine which color is to be used.  Then, in the  Event DblClick cell, a simple formula toggles User.DblClk to be either true or false, specifically, "1" or "0" respectively.  Then, in the FillForeGnd cell of each color changing shape is an "IF" statement that grabs the User.DblClk value and sets the foregnd color depending upon  the result.  This has the added advantage that the colors can be uniquely defined in each shape.

Note, this is just one approach, there are several others.

Oh, it's not necessary to double post.  The categories are more guidelines than actual rules.

Wapperdude
Visio 2019 Pro