Visio Guy

Visio Discussions => General Visio => Topic started by: ToninoS on September 21, 2020, 05:49:52 AM

Title: Text Position Based on User Input List
Post by: ToninoS on September 21, 2020, 05:49:52 AM
Hi all,
Hope you are well!  I wanted to be able to have text line up dependant upon where the shape it is in was placed. The below is how i did it but i was wondering if i could learn from anyone a more efficient way of doing it?

1: i defined some shape variable data as "Text_Position" with 1;2;3;4 as the choices
2: in the PinX for the sub shape text i put in:
        =IF(Sheet.5!Prop.Text_Position=1,Sheet.5!Width*0.4996,IF(Sheet.5!Prop.Text_Position=2,Sheet.5!Width*1.5694,IF(Sheet.5!Prop.Text_Position=3,Sheet.5!Width*0.4786,-0.7464)))
3: in the PinY i put in:
       =IF(Sheet.5!Prop.Text_Position=1,4.7332 mm,IF(Sheet.5!Prop.Text_Position=2,1.4668 mm,IF(Sheet.5!Prop.Text_Position=3,-1.5332 mm,1.4332 mm)))

This does work and i can choose 1 through 4 and the text moves about... of course i did not write the last if statement for choosing "4" so anything other than 1,2 or 3 will possition it as 4 is intended to do.

Any advice if i could have done this better or if i did it as i should have is appreciated.
Cheers
Tonino
Title: Re: Text Position Based on User Input List
Post by: vojo on September 21, 2020, 10:18:45 PM
need to use guards around those pinx / piny functions or a setatref function in pinx / piny  and use user cells to calculate final pinx / piny.

Recently, I created a bug  doing what you are trying to do.  Unfortunately, it corrupted many pages of the drawing and
Undo does not undo the bug.  I had to delete pages and recreate the drawing on the page of interest.  It was a mess!!!
Title: Re: Text Position Based on User Input List
Post by: vojo on September 21, 2020, 10:26:57 PM
See this

http://www.visguy.com/2018/11/07/constrain-control-handle-to-circle/
Title: Re: Text Position Based on User Input List
Post by: ToninoS on September 24, 2020, 03:00:55 AM
See this

http://www.visguy.com/2018/11/07/constrain-control-handle-to-circle/

Hi there vojo, that will help with some other things i am doing.. thanks :)