RRe: Continues flds

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown RRe: Continues flds

by Peter Brigham-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On May 8, 2008, Eric Chatonet <eric.chatonet@...> wrote:

> Bonjour Hershel,
>
> Le 8 mai 08 à 00:53, Hershel Fisch a écrit :
>
>> 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
>
> Two years ago I did it in a kind of 'book' layout: see the LAMM
> project at http://www.sosmartsoftware.com/?r=logiciels&l=en
> As the user could change the text size, I had to reorganize it on -
> the-fly and calculate 'text flow'.
> The only thing I remember well is that was tricky ;-)
> I ended by having a single card with one (or two) field containing
> the whole text (without scroll bar) and just set the scroll
> programmatically combined with a visual effect to 'fake' pages  
> turning.
> So I did not use what you call 'flds continuing' but two fields only
> even if a wipe left/right let the user think the 'card' has changed.
> May be a clue for you?
>
> Best regards from Paris,
> Eric Chatonet.

I have a stack that does this, The Gutenberg Reader, that allows you  
to download texts from the Gutenberg web pages and read them in a  
book-like layout. You can't change the field size but you can change  
the font. It works by putting all the text in a two fields side by  
side, and setting the scroll of each field when you go to the next  
"page." The scroll of the right-hand field (the "righthand page") is  
simply set to the the scroll of the left field + the textHeight*(the  
number of lines visible), so it acts like a book. You can download  
the standalone at
http://home.comcast.net/~pmbrig/Gutenberg.html
and I can email the original stack to anyone interested.
At some point I will probably tackle the problem of allowing resizing  
of the stack and field sizes and/or allowing the user to change the  
fontSize/lineHeight, but I kept it relatively simple. Once you get  
the scrolling routines set in a couple of handlers (scrollToPageNbr
(), pageNbrToScroll(), etc) it works quite smoothly. The user has no  
idea what's happening behind the scenes.

Peter M. Brigham
pmbrig@...
use-revolution mailing list
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Re: RRe: Continues flds

by Andre.Bisseret :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>>
>>
>>> 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
use-revolution@...
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution