You should be able to fill each "palm card" more or less exactly. This script
should get you started.
-- copy all the styled text into the first palm card field
set the htmlText of fld "PalmCard" to the htmlText of fld "AllText"
-- the text needs to be broken into palm card sized chunks
put 1 into tCardCounter
put the number of chars of fld "PalmCard" into tNumOfChars
put the formattedHeight of char 1 to tNumOfChars of fld "PalmCard" into
tCharHeight
put (the height of fld "PalmCard") into tFieldHeight
REPEAT until tFieldHeight >= tCharHeight
put the number of chars of fld "PalmCard" into tNumOfChars
put the formattedHeight of char 1 to tNumOfChars of fld "PalmCard" into
tCharHeight
-- remove extra characters and put the remaining into a new field on a new
card
REPEAT with c = 1 to tNumOfChars
IF the formattedHeight of char 1 to c of fld "PalmCard" >=
tFieldHeight - 24 THEN -- <-24> is wiggle room
put the htmlText of char c to -1 of fld "PalmCard" into tHtmlText
delete char c to -1 of fld "PalmCard"
clone cd tCardCounter
put tCardCounter + 1 into tCardCounter
set the htmlText of fld "PalmCard" to tHtmlText -- put the text that
didn't fit into the new field
exit REPEAT
END IF
END REPEAT -- remove extra characters and put the remaining into a new
field
END REPEAT -- text in the last field fits
--
Scott Morrow
Elementary Software
(Now with 20% less chalk dust!)
web http://elementarysoftware.com/
email [email protected]
office 1-800-615-0867
------------------------------------------------------
On Aug 25, 2013, at 11:37 PM, planix <[email protected]> wrote:
> Hi All,
>
> I am looking for ways to determine the approximate number of characters that
> will fit into a text field of fixed height and width.
>
> I am guessing there is some way of doing this by working with the line
> height, font size, and the height and width of the field. Anyone ever had a
> need to do this? Or is there an obvious way?
>
> I am developing a small project for my 14yo daughter to work on. She is
> always having to produce palm cards for talks at school. Using Word is a
> pain for this sort of thing. I thought it might be fun and useful for her to
> develop a palm card creator. Essentially we would create a base card with a
> text field of fixed height and width. When she types or pastes text into the
> field it would detect when the first palm card is full, create a new one,
> and then flow the text into the next text field. This would go on until all
> the text is entered. Then we print the cards (probably 4-6 to a page) and
> viola - palm cards sorted.
>
> cheers
>
>
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/Any-ideas-on-working-out-number-of-characters-approx-that-can-be-entered-into-a-field-tp4669110.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode