[REBOL] Re: REBOL/View problems and questions
From: gjones05:mail:orion at: 17-Apr-2001 8:28
> From: "Christian Langreiter"
> > Hi REBOLs,
> >
> > I'm pretty new to /View (I've played with it about a year ago but since
> > I have forgotten everything I knew about it) and I've to say it looks
> > _good_. However, on my adventurous rides the first troublemakers are
> > showing up. So those are my questions:
> >
> > A. I have a text-list in a layout. How can I change its contents at
> > runtime? Nothing I have tried (tl/text, /texts, /data) worked. Is it
> > possible at all?
<snip>
From: "Allen Kamp"
> Here is a very quick one. (Perhaps someone can dig out Sterling's example
> which resizes the dragger for the contents, I don't have it on this
machine)
> view layout [tl: text-list "a" "b" "c" [append tl/data random 10 show tl]]
<snip>
Sterling's fix was:
fix-slider: func [faces [object! block!]] [
foreach list to-block faces [
either 0 = length? list/data [
list/sld/redrag 1
][
list/sld/redrag list/lc / length? list/data
]
]
]
and demonstrated by:
view layout [tl: text-list "a" "b" "c" [append tl/data random 10 fix-slider
tl show tl]]
There were some circumstances in which using tl/data (in this example) did
not seem to work, but I can't recall all the conditions. But it seems like
assigning a new block of values to the text-list would not work:
;doesn't work
view layout [tl: text-list "a" "b" "c" [tl/data: ["new" "values"] fix-slider
tl show tl]]
By experimentation, I found that the following does work:
;does work
view layout [tl: text-list "a" "b" "c" [tl/lines: ["new" "values"]
fix-slider tl show tl]]
The difference is using lines refinement instead of data. I also found the
following modification to Sterling's fix works:
; modification based on original by Sterling
; updates the bar on the side of a text-list or group of text-lists
fix-slider: func [faces [object! block!]] [
foreach list to-block faces [
;either 0 = length? list/data [
either 0 = length? list/lines [
list/sld/redrag 1
][
;list/sld/redrag list/lc / length? list/data
list/sld/redrag list/lc / length? list/lines
]
]
]
What I cannot recall (I guess I suffer from chronic relapsing Alzheimer's
and will probably respond to your question nine times! ;) was whether there
was a circumstance where Sterling's fix did not work, and my modification
did. At any rate, that's my two cents.
--Scott Jones