[REBOL] Re: how to get check box state? - mycheckbox/data
From: sanghabum:aol at: 24-Aug-2001 5:51
[arolls--bigpond--net--au] writes:
> > 'Value only works in the action facet for the item itself. So
> > this would work:
> >
> > mycheckbox: check [probe value]
> >
> > though it isn't much use, except to save the value somewhere else:
> >
> > mycheckbox: check [SavedValueforCheckbox: value]
>
> You could use it to enable or disable a group of options.
>
> view layout [check [print either value ["enable"]["disable"]]]
> --
Hi there,
That's true. I guess the point I was stumbling to make was that 'value exists
only in the Action Facet. So you either have to use it there or lose it. But
if your checkbox (or whatever) is named, the value is retained in the /Data
variable. Compare these two bits of code:
unview/all
myaction: func [req] [print ["requested: " req]]
view layout [choice "a" "b" "c" [myaction first value] ]
unview/all
myaction: does [print ["requested: " first mychoice/data]]
view layout [mychoice: choice "a" "b" "c" [myaction] ]
The first passes the value out as a function parameter; the second ignores
the value and uses a global variable by naming the checkbox.
--Colin.