REBOL/View problems and questions
[1/4] from: c:langreiter:tirol at: 15-Apr-2001 17:42
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?
B. I have a field in a layout the contents of which are changed via a
button (f/text: "blah!"). Problem: Once I manually enter data into the
field, I can't change it programmatically any more. Is this a bug or
behaviour to be expected?
Best wishes and thanks in advance,
Chris
[2/4] from: allen:aussieweb:au at: 17-Apr-2001 12:13
----- Original Message -----
From: "Christian Langreiter" <[c--langreiter--tirol--com]>
To: <[rebol-list--rebol--com]>
Sent: Monday, April 16, 2001 1:42 AM
Subject: [REBOL] REBOL/View problems and questions
> Hi REBOLs,
> I'm pretty new to /View (I've played with it about a year ago but since
<<quoted lines omitted: 4>>
> runtime? Nothing I have tried (tl/text, /texts, /data) worked. Is it
> possible at all?
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]]
> B. I have a field in a layout the contents of which are changed via a
> button (f/text: "blah!"). Problem: Once I manually enter data into the
> field, I can't change it programmatically any more. Is this a bug or
> behaviour to be expected?
Use copy if you are assigning the "value".
view layout [f: field button "Click" [f/text: copy "blah!" show f]]
Cheers,
Allen K
[3/4] from: chris::langreiter::com at: 17-Apr-2001 11:07
Allen, merci beaucoup.
I had already solved the problems by intensely staring at some source code,
the post took a long time to go through (why?).
Anyway, the result of my lil' weekend explorations is described here:
http://www.xmlrpc.com/discuss/msgReader$1626?mode=day
Cheers,
Chris
-- http://www.synerge.at
-- http://www.langreiter.com
[4/4] from: gjones05:mail:orion at: 17-Apr-2001 8:28
> From: "Christian Langreiter"
> > Hi REBOLs,
<<quoted lines omitted: 8>>
> > 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
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted