Rebol Programming/scroll-para

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:[edit | edit source]

SCROLL-PARA tf sf 

DESCRIPTION:[edit | edit source]

Scroll a text face, given a scroller/slider face.

SCROLL-PARA is a function value.

ARGUMENTS[edit | edit source]

  • tf -- Text face to scroll (Type: any)
  • sf -- Scroller face (Type: any)

SOURCE CODE[edit | edit source]

scroll-para: func [
    "Scroll a text face, given a scroller/slider face." 
    tf "Text face to scroll" 
    sf "Scroller face" 
    /local tmp
][
    if none? tf/para [exit] 
    tmp: tf/para/margin + tf/para/origin + size-text tf 
    tmp: min 0x0 tf/size - tmp - either tf/edge [2 * tf/edge/size] [0x0] 
    either sf/size/x > sf/size/y [tf/para/scroll/x: sf/data * first tmp] [
        tf/para/scroll/y: sf/data * second tmp
    ] 
    show tf
]