FANDOM


If you try to change font size of a very long field text (with a vertical scroller), you'll notice that text position change. This behavior happen because you change text size, but the current scroll number (pixels) remains the same.

The following code will maintain text position displayed, whatever font size or type you'll choose:

  lock screen
  put the textSize of field myField into temp  
  put  (the effective textheight of fld myField) * (the number of lines in fld  myField) into totalscroll   
  put the vscroll of field "testo" into currScroll
  put currScroll / totalScroll into percentscroll      
  set the textSize of field testo to anotherNumber #here we change text size
  put  (the effective textheight of fld myField) * (the number of lines in fld myField) into totalscroll
  set the vscroll of fld "testo" to trunc( totalScroll * percentScroll  )   
  unlock screen