I'm trying to have text in a field and in the next page (like a
book) or
card it should start where the previous page left off.
Hershel


Hi Hershel (and others in this thread),

A solution could be to use the same trick as one uses in cases of complex printing.

1 - create a new stack (named "niceBook")

2 - put 4 fields on the first card
- one field named "leTexte" (only on the first card) ; it is a scrolling field

- Three other fields, grouped with the backgroundbehavior of the group set to true. They are not scrolling fields one is name "theBuffer"; it receives the content of field "leTexte" temporarily and is then emptied line by line into the fields "onePage"

the other is name "onePage"; it is completed line by line from the field "theBuffer" ; when the field "onePage" on card 1 is completed, then a new card is created, and the field "onePage" on it is competed, and so on until the field "theBuffer" be empty

and the third field in the group is a small one at the bottom of the card named "champNoPage" (it receives the number of each page)

4 - put any long text in field "leTexte" on the first card of the stack; with paragraphs beginning with titles in bold (to test one of the cases of the handler "avoidOrphanLines" (if a title is isolated as a last line of field "onePage" this line is reported at the beginning of the next field "onePage")

Ex.:
------------
Part 1 (in bold)
Msdlkf mllsjd lmq mlsdf mljsf mljmlkj s flopiuoem ml ln mmqf oi xxx luoxu sooisdf o diofqmmfu if mqi mfiq imsdlkf mllsjd lmq mlsdf mljsf mljmlkj s flopiuoem ml ln mmqf oi xxx luoxu sooisdf o diofqmmfu if mqi mfiq imsdlkf mllsjd lmq mlsdf mljsf mljmlkj s flopiuoem ml ln mmqf oi xxx luoxu sooisdf o diofqmmfu if mqi mfiq.
Part 2 (in bold)
Msdlkf mllsjd lmq mlsdf mljsf mljmlkj s flopiuoem ml ln mmqf oi xxx luoxu sooisdf o diofqmmfu if mqi mfiq imsdlkf mllsjd lmq mlsdf mljsf mljmlkj s flopiuoem ml ln mmqf oi xxx luoxu sooisdf o diofqmmfu if mqi mfiq ivp.
Part 3 (in bold)
...
etc etc
------------

5 - on the first card of the stack put a button ("transfer" for exemple) whose script is
on mouseUp
transferText
end mouseUp

6 - set the script of the stack "niceBook" to the set of handlers at the bottom of this message.

7 - click on the button "transfer"
Also, you can try it after changing the size of the field "onePage"

Excuse me for the french words which are remaining ;-))

This set of handlers result of a quick adaptation I just made of a set I am using to print textual reports in a couple of my stacks. Not sure it is optimized (sure it is not :-). When rereading some parts, I am not sure why I wrote them (or why I wrote them this way) ;-)))
But it works here.

If I have well understood what your are trying to do, normally, this script should do what you wanted to (or could approach it :-)

At least seems a way to explore

Best regards from Grenoble
André

-----------------------------------------------
To be placed in the script of the stack :
----------------------------------------------------------------------------------------------------------------
ON transferText
   local truc,
   global lineToAdd,cardNum,gPrintHeight
   ------------------
   put fld "leTexte" into fld  "theBuffer" of stack "niceBook"
set the htmltext of fld "theBuffer" of stack "niceBook" to the htmltext of fld "leTexte" of this stack put the number of lines of fld "theBuffer" of stack "niceBook" into truc
   set the cursor to watch
   reduceStackToOneCard
   --set the printmargins to 72,50,50,72
put field "leTexte" into field "theBuffer" of card 1 of stack "niceBook" set the htmltext of fld "theBuffer" of cd 1 of stack "niceBook" to the htmltext of fld "leTexte" put the height of field "onePage" of stack "niceBook" into gPrintHeight -- - 15 into gPrintHeight
   put empty into fld "onePage"
   put empty into cardNum
   REPEAT until fld "theBuffer" is empty
       put cardNum + 1 into cardNum
       fillOnePage
       put "Page" && cardNum into fld "champNoPage"
   END repeat   #
   go to last card of stack "niceBook"
   IF the number of this cd is not "1" THEN
       IF fld "onePage" is empty THEN delete this cd
   END IF
   reset cursors
END transferText

ON reduceStackToOneCard
   local NbrDeCartes,
   ----------------
   put the number of cds of stack "niceBook" - 1 into NbrDeCartes
   REPEAT NbrDeCartes
       delete cd 2 of stack "niceBook"
   END repeat
END reduceStackToOneCard

ON fillOnePage --remplirUnePage
 global CARDNUM,LINETOADD,GPRINTHEIGHT
 ----------
 go TO CARD CARDNUM
 put the number of lines of fld "onePage" + 1 into lineToAdd
 create card
 go previous
REPEAT UNTIL the formattedheight of fld "onePage" of cd cardNum >= gPrintHeight
   IF the number of lines of fld "theBuffer" = 0 THEN exit repeat
IF line 1 of fld "theBuffer" is empty THEN put cr after fld "onePage" of cd cardNum copy line 1 of fld "theBuffer" -- IT KEEPS THE FORMAT WITHOUT USING HTML select line lineToAdd of fld "onePage" of cd cardNum --FIRST EMPTY LINE
   paste
   set the clipboarddata to empty
   delete line 1 of fld "theBuffer"
   put lineToAdd + 1 into lineToAdd
 END repeat
 formatAgain
 avoidOrphanLines
END fillOnePage

ON formatAgain
IF the formattedheight of fld "onePage" >= the height of field "onePage" THEN REPEAT until the formattedheight of fld "onePage" < the height of fld "onePage"
     --IF the mouseclick THEN exit repeat
     copy last line of fld "onePage"
     go next
     IF the clipboarddata is empty THEN
       put cr before fld "onePage"
     ELSE
       select before fld "onePage"
       paste
       set the clipboarddata to empty
       go previous
       delete last line of fld "onePage"
     END IF
   END repeat
 END IF
END formatAgain

ON avoidOrphanLines
 SWITCH
 CASE the textstyle of last line of fld "onePage" is "bold"\
AND the foregroundcolor of last line of fld "onePage" is empty --"0,0,0"
   copy last line of fld "onePage"
   go next
   select before fld "onePage"
   paste
   set the clipboarddata to empty
   go previous
   delete last line of fld "onePage"
   break
 CASE the foregroundcolor of last line of fld "onePage" is "0,0,255"
   copy last line of fld "onePage"
   go next
   put cr before fld "onePage"
   select before fld "onePage"
   paste
   go previous
   delete last line of fld "onePage"
   break
 CASE first char of last line of fld "onePage" is "*" and\
   the number of chars of last line of fld "onePage" < 50
   copy last line of fld "onePage"
   go next
   put cr before fld "onePage"
   select before fld "onePage"
   paste
   go previous
   delete last line of fld "onePage"
   break
 END switch
END avoidOrphanLines
------------------------------------------------------------------------------------------
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to