[REBOL] Re: newbie text-list questions

2003-10-11 Thread Ingo Hohmann

Hi Kai,

Carl Read wrote:
> On 11-Oct-03, Kai Peters wrote:
<...>
> button "Clear" [
> clear t/data
> show t
> ]
<...>

One thing you should be aware of: you should only _change_the_series_, 
e.g. if you'd use

   t/data: copy [] ; ATTENTION: That's most surely not what you want

the text-list would still hold on to the original series, but you would 
never be able to access it again ...

to see what I mean, just play around with this ...

view layout [
   tl: text-list "1" "2" "3"
   button "add" [append tl/data form now show tl]
   button "Falsely clear" [tl/data: ["a" "b" "c"] show tl]
]


Kind regards,

Ingo


-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: newbie text-list questions

2003-10-11 Thread Carl Read

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 1
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

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.