Control shape width with a list of valid widths

Started by RhesusMinus, October 21, 2010, 04:06:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RhesusMinus

Hi.

Is it possible to enter a formla in the shape sheet that controls the valid width of a shape?
If I have a rectangle, I only want the users to be able to change the width of the shape to 20, 40 and 60 mm.

THL

wapperdude

There are a variety of ways to do this...here's one which uses Shape Data.

Right click your shape to add Data > shape data.  In the menu fill in label & name with something meaningful, e.g. Wth.  For TYPE, select "fixed list".  In the format box, enter your values, separated by ";".  At the bottom, check "Ask on drop".

Next, open the shapesheet and in the Width cell enter the formula: Guard(prop.Wth)
That should do it.


Another way would be to use the shape's right click, context menu.  You can do this by adding the "Actions" section to the shapesheet.  This is a little more involved, but provides the user with slightly more direct access to the values.

HTH
Wapperdude
Visio 2019 Pro

RhesusMinus

Thanks for replying Wapperdude.

Just to be difficult... I want the user th use the handles on the shape to resize it. Much more intuiive for the users. Is t still possible to pre-define valid widths/heights?

THL

wapperdude

Not a problem!  :D

Use the "bound" function.  Check out this link:  http://msdn.microsoft.com/en-us/library/ms406650(v=office.12).aspx.  Actually, the 2nd example does exactly what you want!!!   :o

Wapperdude
Visio 2019 Pro

RhesusMinus

Thank you!
That's ALMOST perfect :)

Now, just to be even more difficult... I want the users to be able to choose between the widths EITHER by dragging the handle, og by changing the Shape Data property (a fixed list :)).
So.. if one drag the handles, the Shape Data should update, and if one changes in the Shape Data, the shape should update :)

Possible?

THL

Jumpy

Then you need some user defined cells filled with SETF-functions. For example:

User.PushShapeData: =SETF(GetRef(Widht),Prop.Width)+DEPENDSON(Prop.Width)

Whenever u change the ShapeData, the Value gets pushed to the Width.
The Dependson is popably not neccessary, but for the sake of understanding.

From that on I would create SETF functions, that monitor the width and push the value to the nearest possible ShapeDate Values.
The change in the ShapeData Value will then trigger a new shape of the width...

Don't know if this will work, because you will have circular references that may lead to undisired loops. But Visio is often clever enough to break those loops... Try it out.


RhesusMinus

Thank you, you've been most helpful!

Everything worked perfectly, just till now.
I need the shape to behave like a 1-dimensional shape. Suddenly my formulas wont work when i stretch the 1D handles... :(


Anyone that can give me a clue?

I'm really starting to enjoy Visio now :)

THL

Yacine

When you switch your shape from 2 to 1 D you will notice that the first section changes.
The width is not anymore a defining property, but a result of a formula depeding on the start and the end points.
You definitely need to adjust your formulas.
Yacine