LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
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
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)?
on scrollbardrag tValue
put the textheight of field "field1" into field "textheight"
put the textsize of field "field1"-1 into field "textsize"
set the textsize of field "Field1" to tValue+8
end scrollbardrag
on scrollbardrag tValue
put the textheight of field "field1" into field "textheight"
put the textsize of field "field1"-1 into field "textsize"
set the textsize of field "Field1" to tValue+8
put the textheight of field "field1" into field "textheight"
put the textsize of field "field1"-1 into field "textsize"
end scrollbardrag
Also I would have never known to do this. How did you know to do the value =8?
TodayIsTheDay,
if you mean by weirdness that texHeight and TexSize are not what you expect from the setting of the TextSize by the scrollbar then maybe this is before you set the textSize to the scrollbarValue you query the values.
So they are the values from your last setting. Try
on scrollbardrag tValue
set the textsize of field "Field1" to tValue+8
put the textheight of field "field1" into field "textheight"
put the textsize of field "field1"-1 into field "textsize"
end scrollbardrag
and it should work. If that is what you mean.
by the way what is the -1 for in "put the textsize of field "field1"-1 into field "textsize""?
regards
Bernd
What I meant was when you moved the scrollbar all the way back to the left, one time it might report text height as 8 the next time as 11 the next time as 10 even though you have the scrollbar all the way to the left.
I didn't understand why....
Does that make sense? Sometimes I can be confusing when I try to explain things.
the -1 was a mistake. I don't know what I was doing there...
You can also set the startValue and endValue properties of the scrollbar to 8 and 74 respectively, and then you don't have to add 8 to the thumbPosition of the scrollbar to determine the textHeight.