Widow control

Sarah Reichelt sarah.reichelt at gmail.com
Tue Dec 23 06:03:36 EST 2008


On Tue, Dec 23, 2008 at 11:28 AM, william humphrey <shoreagent at gmail.com> wrote:
> I'm trying to figure out how to stop filling a field and move on to the next
> field without breaking a "paragraph" in the middle.Fixed subject to "Widow
> Control"
>
> Say the field is ten lines long and you have fifty rows of data and you want
> to split the data into the ten line long fields without breaking a paragraph
> in the middle unless a paragraph is over ten lines long and you have to
> (although that is rare).
>
> I'm having trouble figuring out an easy way to walk through these lines of
> data and put in the breaks as need be. One of the problems is you can't say
> there are five pages in total (50 / 10 ) as sometimes a page will only have
> say six rows because in order to have widow control you have to start the
> next six or seven line long paragraph on the next page.
>
> Any simple ideas on how I should look at this differently?

I'm not sure I completely understand the problem, but I suggest
looking at the formattedHeight of the field.

in pseudo-code:

put the complete text into the field
repeat until the formattedHeight of the field is less than the actual
height of the field
   delete the last line of the field
end repeat

see how many lines are in the field
delete that many lines from the start of the original data
move to the next field and repeat the process

HTH,
Sarah



More information about the use-livecode mailing list