[REBOL] any suggestions for updating a choice field in a view?
From: mh983:y:ahoo at: 8-Sep-2001 22:21
I haven't found a very straight-forward way to update the selected value in a choice
field. For example, perhaps you
want a button click to cause the selected value in a choice field to change:
view layout [
mychoice: choice "one" "two" "three"
button "change it" [
mychoice/data: find mychoice/data mychoice/text
what I did was three steps:
1. mychoice/text: "two" ;sets the text of the choice to the desired value
2. mychoice/data: find mychoice/data mychoice/text ; finds the text in the data series
and updates the series to that
3. show mychoice ; refresh the choice field on the screen
One thing to be careful with is that you can set the text of the choice to something
that is not already in the list. I guess
you could turn the steps around and find the item in data first, then only if it is found
do you set the text.
Does anyone know of an simpler way that I'm missing, or is this the way to do it? Thanks.