[REBOL] Scrolling question
From: kpeters::otaksoft::com at: 9-Aug-2007 9:47
I have tried to marry Carl's example on "Adding a scrollbar to text" to the source of
request-list because I need to let my users choose from very wide strings and thus also
require a horizontal scrollbar.
Carl defers calling reset-tface by moving it into the action of his example's button;
if you
click on his scrollbar before opening a file via the button, the script dies. So does
mine :(
I believe I need to call reset-tface bu tI can't seem to figure out how to call it from
within...
It seems to me that (part of?) the problem is that one cannot refer to a "named" face
while still executing/being in layout? Is that a valid assessment?
Could someone kindly help me out with this one?
As always, any help is much appreciated.
Kai
request-list: func [titl [string!] alist [block!] listboxsize [pair!] /offset xy /local
rslt list-lay ][
reset-tface: func [txt bar][
txt/para/scroll/x: 0
bar/data: 0
update-tface txt bar
show [txt bar]
]
scroll-tface: func [txt bar][
txt/para/scroll/x: negate bar/data * (max 0 txt/user-data - txt/size/x)
show txt
]
update-tface: func [txt bar] [
txt/line-list: none
txt/user-data: second size-text txt
bar/redrag txt/size/x / txt/user-data
]
list-lay: layout [
origin 10x10
h3 titl
space 0 ; hug the text box
tl: text-list listboxsize font-name font-fixed data alist [rslt: value hide-popup]
sb: scroller to-pair reduce [ first listboxsize 16 ] listboxsize [ scroll-tface tl sb
]
; reset-tface tl sb
space 10x10
btn-cancel #"^[" [rslt: none hide-popup]
]
rslt: none
either offset [inform/offset list-lay xy] [inform list-lay]
rslt
]