[REBOL] Re: Info on 'list style
From: felixs:ihug:au at: 17-Apr-2002 6:06
Hi Alan,
I had the same problem but I found
http://www.rebol.org/userlist/archive/504/765.html
I played with it a little and ended up with this
( I took out the 3l33t column sorting bit though ;)
REBOL [
row-item: make object! [
val1: copy ""
val2: copy ""
val3: copy ""
]
list-data: copy []
for i 1 50 1 [ append list-data make row-item [ val1: reform ["Item" i]
val2: "Column number 2" val3: "Col 3"] ]
onSel: func [row-index] [
itm: pick list-data row-index
if none? itm [exit]
print reform ["picked:" itm/val1]
]
;- For the scroll bar
cnt: 0
sel: -1
curr: 0
count: 0
data-list: layout [
origin 0x0
space 0x0
across
button "Col1" 50
button "Col2" 180
button "Col3" 74
return
tbl: list 300x200 [
origin 0
pad 0x0
across
space 0
txt 50x20 [sel: curr unfocus show tbl onSel sel]
txt 180x20 [sel: curr unfocus show tbl onSel sel]
txt 74x20 [sel: curr unfocus show tbl onSel sel]
] supply [
curr: count + cnt
face/text: copy ""
face/color: ivory
if even? count [face/color: ivory - 20.20.20]
row-itm: pick list-data curr
if none? row-itm [exit]
switch index [
1 [ str: row-itm/val1 ]
2 [ str: row-itm/val2 ]
3 [ str: row-itm/val3 ]
]
face/text: str
face/font/color: black
if sel = curr [face/color: 160.255.160]
]
sld: slider 16x200 [
c: max 0 to-integer (length? list-data) * value
if c <> cnt [cnt: c show tbl ]
]
]
view data-list
]
One thing I'm not sure of how to do though, is to make this into a reusable
widget. Could anyone give me an idea of where to start on that?
HTH,
Felix
----- Original Message -----
From: "alan parman" <
[reboler--programmer--net]>
To: <
[rebol-list--rebol--com]>
Sent: Tuesday, April 16, 2002 11:05 AM
Subject: [REBOL] Re: Info on 'list style
> Thanks for the pointers, Anton and Geza!
>
> I now have nearly complete success with what I wanted to do with 'list and
supply.
> One more thing though, if you all would be so kind...
>
> Anton's scroller demo is still a bit complex for me (especially given that
I am still learning the 'list style). Anton, the demo mentions that your
special scroller style is not necessary for scrolling a 'list.
> What are the essentials for scrolling a 'list?
> (I know about 'scroll-para and have and have used 'crop on images, and
investigated the origin method, but none of these work on 'list). Is it
similar to a 'text-list, with face/sld/data and face/sn, etc?