[REBOL] Re: newbie text-list questions
From: carl:cybercraft at: 24-Dec-2003 22:39
On 11-Oct-03, Kai Peters wrote:
> Hi list ~
> How do I
> - add lines to a text-list dynamically
> - knowing that any windows control of this type can only hold a
> finite number of list items, how do i clear a text-list say every
> 1,000 entries?
The lines in a text-list are held in a block called data, so...
view layout [
t: text-list
button "Add Line" [
append t/data to-string random 10000
show t
]
button "Clear" [
clear t/data
show t
]
; Sort example added while I'm at it...
button "Sort" [
sort/compare t/data func [a b][(to-integer a) < to-integer b]
show t
]
]
(Note you can cut and paste that layout directly into the View Console
to test it, just in case you've not discovered this feature yet.)
use...
length? t/data
to check how many items are in the above list.
There are of course ways to update the scroll-bar, but I can't
remember the current best method, (it's been improved with the beta
versions I think), so someone else would be best to explain that.
Hope that helps.
--
Carl Read