Vertically aligning text in a field
J. Landman Gay
jacque at hyperactivesw.com
Sat Dec 20 14:18:35 EST 2014
On 12/20/2014, 12:41 PM, Geoff Canyon wrote:
> If the formattedRect breaks on mobile, then that's a bug for the LC team,
> but other than that, doesn't my two-line solution work? I'm not seeing a
> way to break my two-line solution? What is the need for a more complex
> solution?
It doesn't quite center correctly, at least not my multi-line wrapped
field. It may have something to do with the calculations in the
formatted* commands.
I found that by adding a small number of pixels to the top margin I
could get it close, which is what Bernd was doing too. I've been trying
to figure out where the problem is, but like him, I don't see anything
offhand. I'm pretty sure the engine must either be adding padding to the
top line, or else not reporting the underhang of the last line, which
makes the formattedWhatever functions not quite exact.
BTW, I could reduce your calculation to a one-liner by using the
formattedHeight instead of the formattedRect; it returns the same result
-- which isn't quite right, but matches what you got.
set the topmargin of fld 1 to the height of fld 1 - the formattedheight
of line 1 to -1 of fld 1
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list