ScrollBar, text size and height
Posted: Sat Oct 10, 2009 3:48 am
I have a script that uses the scrollbar to change the size of text in a field and put the size and height of the text into two other fields.
I'm sure this is not the way to do this but it seems to sort of work...
Can someone please tell me how would be the correct way to do this?
And can someone please explain why this script acts the way it does?
For instance, if you start sliding the scrollbar, sometimes the numbers in the field telling you how big the text is does not change but you can clearly see the text getting bigger....
Sometimes when you slide the scrollbar all the way back to the left it does not go to the lowest number in my script (9)?
http://screencast.com/t/EHJK55WwnW
Thanks!
Code: Select all
on scrollbardrag tValue
put the textheight of field "field1" into field "textheight"
put the textsize of field "field1"-1 into field "textsize"
if tValue =1 then set theTextSize of field "Field1" to 9
else if tValue =2 then set the TextSize of field "Field1" to 10
else if tValue =3 then set the TextSize of field "Field1" to 11
else if tValue =4 then set the TextSize of field "Field1" to 12
else if tValue =5 then set the TextSize of field "Field1" to 13
else if tValue =6 then set the TextSize of field "Field1" to 14
else if tValue =7 then set the TextSize of field "Field1" to 15
else if tValue =8 then set the TextSize of field "Field1" to 16
else if tValue =9 then set the TextSize of field "Field1" to 17
else if tValue =10 then set the TextSize of field "Field1" to 18
else if tValue =11 then set the TextSize of field "Field1" to 19
else if tValue =12 then set the TextSize of field "Field1" to 20
else if tValue =13 then set the TextSize of field "Field1" to 21
else if tValue =14 then set the TextSize of field "Field1" to 22
else if tValue =15 then set the TextSize of field "Field1" to 23
else if tValue =16 then set the TextSize of field "Field1" to 24
else if tValue =17 then set the TextSize of field "Field1" to 25
else if tValue =18 then set the TextSize of field "Field1" to 26
else if tValue =19 then set the TextSize of field "Field1" to 27
else if tValue =20 then set the TextSize of field "Field1" to 28
else if tValue =21 then set the TextSize of field "Field1" to 29
else if tValue =21 then set the TextSize of field "Field1" to 30
else if tValue =23 then set the TextSize of field "Field1" to 31
else if tValue =24 then set the TextSize of field "Field1" to 32
else if tValue =25 then set the TextSize of field "Field1" to 33
else if tValue =26 then set the TextSize of field "Field1" to 34
else if tValue =27 then set the TextSize of field "Field1" to 35
else if tValue =28 then set the TextSize of field "Field1" to 36
else if tValue =29 then set the TextSize of field "Field1" to 37
else if tValue =30 then set the TextSize of field "Field1" to 38
else if tValue =31 then set the TextSize of field "Field1" to 39
else if tValue =32 then set the TextSize of field "Field1" to 40
else if tValue =33 then set the TextSize of field "Field1" to 41
else if tValue =34 then set the TextSize of field "Field1" to 42
else if tValue =35 then set the TextSize of field "Field1" to 43
else if tValue =36 then set the TextSize of field "Field1" to 44
else end if
end scrollbardrag
Can someone please tell me how would be the correct way to do this?
And can someone please explain why this script acts the way it does?
For instance, if you start sliding the scrollbar, sometimes the numbers in the field telling you how big the text is does not change but you can clearly see the text getting bigger....
Sometimes when you slide the scrollbar all the way back to the left it does not go to the lowest number in my script (9)?
http://screencast.com/t/EHJK55WwnW
Thanks!