Does the formattedText only work in a field on the current card? Is it not possible to retieve the formattedText from a field on another card and modify the text accordingly before going to that card?
I have multiline text over 5 lines which I place in a field on another card before going to the card.
the code is
Code: Select all
-- tWord contains FLAMENCO DANCER for example
-- item 2 of tWordLine contains 4
-- kCardCount is the loop variable 1 to 4
put cr& tWord &cr&cr&cr& item 2 of tWordLine into tWordForDisplay
put "playCardFld_"& kCardCount into tPlayCardName
put tWordForDisplay into fld tPlayCardName of card "playCard"
Now this example will wrap onto 6 lines so I want to remove one of the 3 blank lines to keep the line count at 5.
This is the code I used
Code: Select all
-- check formattedtext to see if multiLine
put the number of lines in the formattedText of fld tPlayCardName of card "playCard" into tNumberOfFormattedLines
-- should be 5 - blank, word, blank, blank, blank, number
if tNumberOfFormattedLines > 5
then -- take out a blank line
replace cr&cr&cr with cr&cr in fld tPlayCardName of card "playCard"
end if
FLAMENCO DANCER is still on one line. The numberofFormattedLines is 5 even though it has been retrieved from the text field on the next card. When the stack goes to the next card FLAMENCO DANCER is shown on 2 lines, the numberOfFormattedLines is 6 and the extra line has not been removed.
I suppose I could do this manipulation in an OpenCard handler but I would like to understand why it doesn't work.
I'm using LC 8.1.3 Indy
Many thanks