Triggering change of FontSize

Started by qw12, March 02, 2010, 01:02:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

qw12

#15
Quote from: qw12 on March 04, 2010, 12:42:08 PM
Quote from: Jumpy on March 04, 2010, 12:27:14 PM
Ok, I use Visio 2007 Professional and there could be a difference.
But I always thouhgt the family of SETATREF-functions was introduced ot Visio with Version 2003, so I don't see why it won't work.

Try the attached drawing.
Thanks for the drawing, but problem still active....However, I'll see if I can do the test on a Visio 2007. Perhaps I'm misunderstanding you....
I've now tried the file in Visio 2007, and indeed the formula is preserved!!  :)
If some knowledgeable person knows the difference between SetAtRef in Visio 2003 and Visio 2007, I'm eager to hear...

qw12

Quote from: Jumpy on March 04, 2010, 02:53:41 PM

I hope this will help.

Sure!  :) This was what I've been looking for since years!!!!
I cannot understand why this is not a standard feature or standard shape in Visio.
So many times, I have had drawings that need resizing, and the problem is always the resizing of the text.
The perfect thing would be to have a property "Font resizable" (on any shape with text)

btw, is there some trick so that you can differ this "scalable text" shape from a normal text shape? perhaps that when activated you have a red border or similar, but only when activated?

vojo

I'll take one step further:

setatexpr(<user input>)*some_formula  is so powerful for visio development, Visio should, at the very least, have this in the help pages
(current help is not clear that you could use this to catch input while preserving yet applying the forumla for the targeted cell of the input...vs.... that
incredibly obtuse example tabout changing something here changes something there).

ideally, since only developers care about this.....why not make EVERY cell along the lines of setatexpr(<user input>) * 1
Only developers would get into shapesheet...end user could care less since still behaves the desired way.

Jumpy

Quote from: qw12 on March 04, 2010, 06:49:49 PM
btw, is there some trick so that you can differ this "scalable text" shape from a normal text shape? perhaps that when activated you have a red border or similar, but only when activated?

Some suggestions:
You could add a further user cell, i.e. User.AutoScale and set it's value to True or False.
The VBA - Code could check this cell, if it's False -> Exit Sub, if it's True -> Carry on.

To change the Value in the User.AutoScale cell and thus the behaviour of the shape, you could use a line in the Action section of the ShapeSheet and so create an entry in the right-click-menu.
In the Action cell: =NOT(User.AutoScale)
In Menu cell: =If(User.AutoScale,"de","")&"activate AutoScale"

Lust but not least you could change for example the LineColor when AutoScale = True with:
=If(User.AutoScale,RGB(a,b,c),RGB(x,y,z))

----------
Another way would be to use a ShapeData property but that is less elegant.

qw12

Quote from: Jumpy on March 04, 2010, 02:53:41 PM

I hope this will help.
I've now come that far, that I would like to have this VBA code in the Master shape.
Is this possible?

I don't want the VBA -code to be in the drawing-file. If I copy the drawing, the code does not work anymore

aledlund

Allowing code to execute in 'shapes' was pulled about eight years ago because of security concerns....
al

qw12

ok, obviously I'm late  :)
Where would the the best place be, to place the code, so it always accesible?

vojo

this can all be in the cells in the shape.

could even do autoscale there

user.autoscale_value = width/nominal textwidth                      (something like = textwidth/5mm)
user.autoscale_ctl = if(action.autoscale.checked, setf(getref(user.autoscale), user.autoscale_value), setf(getref(user.autoscale), 5mm)
user.autoscale = <value from ctl>

textwidth = user.autoscale *1mm

qw12

I'm sorry but I don't get it.
How do I get it into the shape. I can only get the code into "ThisDcoument" of a .vsd or .vss file.

vojo

lt click shape....rt click shape
pick show shapesheet

you will see all the shape cells to play with

add user section
insert==>section==>user

add text transform
insert==> section==>texttransform

add cells
select any row in desired section
insert==>row

update a cell
select cell
on command line, put in desired function

qw12

#25
truly sorry, but I don't get this to work.
I assume, that you do not use VBA, but only formulas in the shapesheet?

Trying this, I got stuck with
user.autoscale_ctl = if(action.autoscale.checked, setf(getref(user.autoscale), user.autoscale_value), setf(getref(user.autoscale), 5mm)

what is meant by 'action.autoscale.checked'?

[quoute]
textwidth = user.autoscale *1mm
[\quoute]
I suppose char.size is meant. Textwidth does not change the font size

I use visio2003

Jumpy

Quote from: qw12 on January 07, 2011, 07:05:39 AM
what is menat by 'action.autoscale.checked'?

First of all you have to create an entry in the Action Section of the ShapeSheet like I suggested some time ago. Call it autoscale.
In the cell "menu" oh the entry you write: "Autoscale".
In the cell "action" you write =SETF(GetRef(action.autoscale.checked),Not(action.autoscale.checked))

If you do that and right click on that shape an click on that entry the checked entry gets unchecked and vice versa.

Vojos user defined cells now look if it's checked or unchecked and evaluate accordingly.

qw12

thanks jumpy and vojo, I now got this to work. :)

Quote
In the cell "action" you write =SETF(GetRef(action.autoscale.checked),Not(action.autoscale.checked))
should be
=SETF(GetRef(actions.autoscale.checked),Not(actions.autoscale.checked))