[REBOL] Re: list vs. text-list
From: greggirwin:mindspring at: 1-Apr-2003 17:32
dbc> I've been trying to get a scrollable list working in View. I'm using List,
dbc> since it was easier to get the column formatting correct, than in Text-list.
dbc> Now the problem is I need to make the
dbc> List vertically scrollable. Is there a way to do this easily?
Sort of easily. :) Below is an example for you. Let me know if it
helps, and watch for wrap.
Title: "Scrolling LIST Example"
Author: "Gregg Irwin"
t-1: t-2: t-3: t-4: t-5: c-1:
count: ; The index of the current item being fetched for display.
ml-cnt: ; Used to track the result list slider value.
visible-rows: ; How many result items are visible at one time.
items: make block! 400
repeat i 400 [
append/only items reduce [
i random "ACBD" random 1000 random "AGCT"
lay: layout [
style col-hdr text 50 center black mint - 20
col-hdr "C1" col-hdr "C2" col-hdr "C3" col-hdr "C4"
main-lst: list 207x300 [
across space 1x0 origin 0x0
style cell text 50x20 black mint + 25 center middle
c-1: cell cell cell cell
] supply [
count: count + ml-cnt
item: pick items count
face/text: either item [pick item index][none]
sld: scroller 16x300 [
if ml-cnt <> (val: to-integer value * subtract length? items visible-rows) [
visible-rows: to integer! (main-lst/size/y / c-1/size/y)
sld/redrag divide visible-rows max 1 length? items
sld/step: max .001 divide 1 max 1 length? items
sld/page: sld/step * visible-rows