[REBOL] Re: Text Area scroll.
From: philb:upnaway at: 10-Dec-2003 11:07
Hi Bruno/Carlos,
Here is another text-area scroll demo ....
rebol [
Title: "Area with scroller"
Author: "Phhil Bevan"
Date: 10-Dec-2003
Version 0.0.1
]
pos-scroll: func [tx sl /local tsize ts-max tmp] [
tsize: size-text tx
either tsize/y <= tx/size/y
[sl/redrag 1 sl/data: 0]
[
sl/redrag tx/size/y / tsize/y
ts-max: tsize/y - tx/size/y
tmp: min 1 (- tx/para/scroll/y / ts-max)
if all [sl/data = 1 tmp = 1] [tmp: 0.999]
sl/data: tmp
]
show sl
]
lv-lay: layout [
space 0
across
tx: area 400x200 feel [
engage: func [face action event] [
ctx-text/edit/engage face action event
if all [event/type = 'key] [pos-scroll tx sl]
]
]
sl: scroller 16x200 [scroll-para tx sl]
]
pos-scroll tx sl ; set original size
view lv-lay
----------------------------------
Cheers Phil