PDA

View Full Version : dynamic Textfield with dynamic width...


Rasta Gonzales
05-07-2002, 03:06 PM
...well, I thought this was a piece of cake, but I cant find the way how to make a dynamic Textfield with dynamic width...

What I do is the following:

make a textfield, define it as a dynamic tf, give it a var value, make sure there's a CIRCLE at the lower-right corner of the TF (which means it's one with dynamic width, doesn't it?!) and via mouseover a button give it another string-content that'
s longer than the original width of the tf.

normally it should be scaled to fit the text into,
but it doesn't. I tried embedding fonts, HTML style TF, selectable or not...

what do I do wrong???

:confused: :confused: :confused:

A fast reply would be apreciated...

mad_A
05-07-2002, 03:29 PM
I presume you talking about MX here?

One way of getting around the problem is to have a textfield with a fixed width and set it's width to one character. Then assign the same text to it as you have to the one that is visible. Get the maxscroll value of that one and multiply it by the average width of a character (width of the alphabet/26) and set the other textfields ._width property to that value.

Bit of a long way about it though!

A:(

Rasta Gonzales
05-07-2002, 03:34 PM
...sounds like it could work, but I think dynamic-width-textfields are just for that...but why don't my textfields do what I want them to?

:mad:

sonicoliver
10-20-2008, 07:33 AM
I presume you talking about MX here?

One way of getting around the problem is to have a textfield with a fixed width and set it's width to one character. Then assign the same text to it as you have to the one that is visible. Get the maxscroll value of that one and multiply it by the average width of a character (width of the alphabet/26) and set the other textfields ._width property to that value.

Bit of a long way about it though!

A:(

that would work with mono-spaced fonts, but for the rest it might be a better idea to do the same thing with a string of characters more commonly used with the language you are working with:

E 12.51%
T 9.25
A 8.04
O 7.60
I 7.26
N 7.09
S 6.54
R 6.12
H 5.49
L 4.14
D 3.99
C 3.06
U 2.71
M 2.53
F 2.30
P 2.00
G 1.96
W 1.92
Y 1.73
B 1.54
V 0.99
K 0.67
X 0.19
J 0.16
Q 0.11
Z 0.09

...but there might also be a solution with CS4... so I'm going to put on beastie boys "intergalactic" and try that right now.