Newbie VID question ctd.
[1/3] from: kpeters:mvinc at: 4-Oct-2003 15:36
The text part works fine, but another questions just popped up:
Why does the face/color not get set to what I would expect, but black instead?
Thanks again,
Kai
toggle_start: toggle 60 "Start" mint
[
face/color: pick [yellow red] face/data
face/texts/1: pick ["Stop" "Start"] face/data
show face
]
[2/3] from: SunandaDH:aol at: 4-Oct-2003 18:50
Kai:
> Why does the face/color not get set to what I would expect, but
black
> instead?
> toggle_start: toggle 60 "Start" mint
<<quoted lines omitted: 3>>
> show face
> ]
'yellow and 'red aren't being interpreted as RGB tuple numbers -- they are
being seen as words in a block. Try this:
unview/all
view layout [
toggle_start: toggle 60 "Start" "Stop" mint
[
face/color: pick reduce [to tuple! yellow to tuple!
red] face/data
show face
]
]
(As Gregg has gently pointed out, the whole pick thing for the text is
over-engineered. Just list the texts as part of the toggle -- as above).
Sunanda.
[3/3] from: greggirwin::mindspring::com at: 4-Oct-2003 17:27
Hi Kai,
KP> Why does the face/color not get set to what I would expect, but black instead?
Because you're returning a word! from the block [yellow red], not a
tuple! value. Just add a REDUCE and you're all set.
view layout [
toggle-start: toggle 60 "Start" mint [
face/color: pick reduce [yellow red] face/data
face/texts/1: pick ["Stop" "Start"] face/data
show face
]
]
It takes some getting used to when REBOL does, or doesn't, evaluate
things, but if you get black where you expect a color you've used
word for, that's almost always the cause.
You can also just specify the colors directly, though it doesn't give
you the "untouched" color (mint) as you have above:
view layout [
toggle-start: toggle 60 "Start" "Stop" yellow red
]
-- Gregg
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted