Formatted text in a field.

Michael Doub mikedoub at
Wed Apr 2 17:44:54 EDT 2014

I am trying to understand how to manage formatted text in fields and I am missing something.  I have field “in” that contains a long page of formatted text that ultimately will be hidden.   I have another field “out” where I am trying to page the data from field “in” like pages of a book (no scrolling)

I thought I would loop thru the lines of field “in” from a starting_line and increase the ending_line until the formattedheight of lines stating_line to ending_line of field “in” > the height of field “out”.  Then back off the ending_line by 1.   I thought this would work, but it seems that I am not comparing the right things.

The height of field “out” seems to be less than what can actually be seen in field “in”.   The algorithm tells me that I can only fit 14 lines of data into field out, where i really can fit 24.

So, what am I missing?  I must not be comparing the correct things.   BTW, I have the fixed line height turned off for both fields.

Seperate from my comparison issue,  Is there a better technique to accomplish this paging operation?   Ultimately, I need to page both forward and backwards.

I appreciate any guidance that you all can provide.


on loadpage 
   put current_line + 1 into startline
   put startline  into endline
   put the number of lines in fld "in" into lastline
   put the height of fld "out" into max_height
   repeat until  endline > lastline
      put the formattedheight of line startline to endline of fld "in" into new_height
      if new_height >= max_height then
          put endline - 1 into endline
         put endline - 1 into lastline
         add 1 to endline 
      end if
   end repeat
   set the htmlText of fld "out" to the HtmlText of line startline to endline of fld "in"
   put endline into currentline
end loadpage

More information about the Use-livecode mailing list