[REBOL] Re: How do you set default values in buttons
From: sanghabum:aol at: 5-Jul-2001 19:04
[ptretter--charter--net]:
> How do you set default values in buttons, rotarys, choices, and
> toggles. Also how do you obtain the value of a choice?
Hi Paul,
I don't know about buttons or toggles, but here's rotarys and choices:
mylayout: layout [
Rot1: rotary "a" "b" "c" "d"
[print ["Rot1: you selected " first value]]
Cho1: choice "a" "b" "c" "d"
[print ["Cho1: you selected " first value]]
]
Rot1/data: find rot1/data "b"
Cho1/text: "c"
unview/all
view mylayout
Note the different method of setting the initial value. With a rotary /Data
contains the series values ("a" "b" "c" "d" in the example), so you position
within that series. That doesn't work for Choices. Here you simply set a
value in the /Text. Why this is, I don't know....I just know it works.
In both cases, Value is a special variable in the Action Facet. It is a
series positioned at the item selected (hence Print FIRST Value).
Hope that helps,
Colin.