Set Text to the Vertical Center of the field
J. Landman Gay
jacque at hyperactivesw.com
Sat Apr 2 13:57:44 EDT 2016
On 4/2/2016 12:54 PM, J. Landman Gay wrote:
> On 4/1/2016 11:08 PM, Sannyasin Brahmanathaswami wrote:
>> on mouseup
>> set the textsize of me to 28
>> put the formattedheight of me into tTotalTextHeight
>> put ( ( the height of me - tTotalTextHeight ) / 2) into tTopBottomMargins
>> set topmargin of me to tTopBottomMargins
>> end mouseUp
>>
>> But it doesn't and the vertical position varies depending on the
>> number of lines.
>
> Try this:
>
> on verticalAlign
> put the formattedheight of line 1 to -1 of me into tTotalTextHeight
> put ( ( the height of me - tTotalTextHeight ) / 2) into
> tTopBottomMargins
> set topmargin of me to tTopBottomMargins
> end verticalAlign
>
> The formattedheight of the entire field apparently isn't the same as the
> formattedheight of the totals of the lines. At least, the above worked
> in my limited test.
>
BTW, I set the fixedlineheight of the field to true.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list