[REBOL] Re: How to refresh a text-list
From: philb:upnaway at: 27-Feb-2002 16:43
Hi Ashley,
Not too sure about tell-list fro all occasions.
Suppose I had a text list with say 3000 entries
(I have a text-list as part of my emailer reader has at least one folder with this many
enteries).
If I delete a single entry then tell-list will clear the whole list and copy (3000 -1)
items from value back into fce/data.
fix-slider assumes that the face data has been amended.
Of course you could supply a refinment to decide whether to clear & replace the data,
tell-list/replace and get the best of both worlds.
Cheers Phil
=== Original Message ===
Thanks to all who responded. Of the two solutions that addressed the slider
issue, I believe the "tell-list" solution appears to work better (please
note that this is more a comment on the vagaries of text-list usage than
the code snippets received!). Try the following with the first dir listing
larger than the second (ie. showing what happens when the number of entries
is reduced).
rebol []
tell-list: func [fce value] [
append clear fce/data copy value
clear fce/picked
fce/sld/data: 0
fce/sn: 0
fce/line-list: none
fce/sld/redrag fce/lc / max 1 length? head fce/lines
show fce
]
fix-slider: func [faces [object! block!]] [
foreach list to-block faces [
list/sld/redrag list/lc / max 1 length? head list/lines
]
]
view layout [
a: text-list data read %..
button "Tell" [tell-list a read %.]
b: text-list data read %..
button "Fix" [b/lines: read %. fix-slider b show b]
]
Click on the last row of each list and then press "Tell" followed by "Fix" . . .
Regards,
Ashley