Text height

Sarah Reichelt sarah.reichelt at gmail.com
Fri Feb 24 00:53:14 EST 2006


On 2/24/06, Marty Knapp <martyknapp at comcast.net> wrote:
> Hi all,
>
> I have a field with a fixed line height and a slider so the user can
> adjust the text size. What I'm trying to do is dynamically change the
> line height as the size is changed so that the line spacing stays
> proportional. Here's my script in the slider:
>
> local LH
>
> on mouseDown
>   put the textsize of fld "Type"/the textheight of fld "Type" into LH
> end mouseDown
>
> on mouseStillDown
>   set the textsize of fld "Type" to the thumbPosition of me
>   set the textHeight of fld "Type" to round(the thumbPosition of me*LH)
> --newHeight
> end mouseStillDown
>
> It works every other time. When it doesn't work it appears to have the
> default line spacing. Then I'll try it again and the line spacing is
> reduced to where it should be . . .  I've tried setting the fixed line
> height in the script, to no effect. (the property is set for the field)
> I'm sure it's something obvious, but it's not jumping out at me. Anyone?
>

I think it may be because the thumbPosition will not always be an
integer and so setting the property will fail. Try using round(the
thumbPosition of me) and seeing if that makes it any better.

Cheers,
Sarah



More information about the use-livecode mailing list