Vertically aligning text in a field
m.schonewille at economy-x-talk.com
Tue Dec 16 12:04:43 CET 2014
There's a long discussion about this on the forum. I believe I did a
good attempt, but Bernd's solution was probably the most reliable.
Economy-x-Talk Consulting and Software Engineering
Installer Maker for LiveCode:
Buy my new book "Programming LiveCode for the Real Beginner"
LiveCode on Facebook:
On 12/16/2014 11:54, Terence Heaford wrote:
> Is there a definitive calculation that correctly sets the position of text vertically in a field?
> I am using LC 6.7.
> I have come across a few ideas like the one below that all appear to use an arbitrary offset to the margins, is there a method to calculate this accurately?
> put the effective textSize of fld id tID into tTextSize
> -- put round (((tTextSize - 22) * 1/3)) into tOffset
> put round (((tTextSize - 24) * 1/3)) into tOffset
> put the formattedheight of char 1 to - 1 of fld id tID into tFormattedHeight
> put round((the height of fld id tID - tFormattedHeight) / 2) into tVerticalMargins
> put tVerticalMargins - tOffset into tTopMargin
> put tVerticalMargins + tOffset into tBottomMargin
> set the margins of fld id tID to 8,tTopMargin,8,tBottomMargin
> All the best
More information about the use-livecode