Vertical Centering Text

Jeanne A. E. DeVoto jeanne at runrev.com
Tue Apr 15 01:38:16 EDT 2003


At 6:03 AM -0700 4/11/03, Ivers, Doug E wrote:
>I'm also interested in a function that does this accurately for
>all possible fonts, styles, lineHeights, etc.  This seems to me
>to be very useful for a one line field (such as username/password
>entry).

Here's a quick one. It does assume there's only one (unwrapped) line of
text in the field:

on verticalCenter theFieldName
  put the effective textHeight of field theFieldName into myHeight
  get the height of field theFieldName - myHeight
  set the topMargin of field theFieldName to it div 2
end verticalCenter

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - Software at the Speed of Thought
http://www.runrev.com/





More information about the use-livecode mailing list