On 4/2/2016 4:42 PM, Richard Gaskin wrote:
That one's just a longer version of Jacque's algo, which gets the
difference between the formatted height of the text from the field, and
set the topMargin to half of that.
That's logical and should work, but trying my version this morning and
later Jacque's and this one, all of them are a bit off and more than a
bit funky: if you click the button multiple times the text moves up and
down in ever smaller increments before settling into a position that's
somewhat close the vertically centered, but too high in tall fields and
too low in short fields.
Okay, I think I have this partly figured out. I saw the same jiggling,
but now that I know the margins are part of the formattedheight, it
makes sense. On every click, the margins were reset and the
formattedheight changed.
So the solution seems to be:
1 get the formattedheight of only the lines (which ignores the margins)
2 calculate the extra empty space above and below that text
3 divide the space in half to get a top margin
4 add in half the ascender/descender padding (about 33% of textheight)
I think...
--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode