Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

Default choice

 [1/3] from: atruter::hih::com::au at: 21-Mar-2002 11:57

Experimenting with default choices, anyone know of other / better ways than the following? view layout [ title "Choice" a: choice data [1 2 3] do [a/text: 2] b: choice data [1 2 3] do [b/text: b/data/2] ] Regards, Ashley

 [2/3] from: mh983:usa at: 22-Mar-2002 23:01

Hi Ashley, I haven't quite figured out how to programmatically set a different value for a choice either. I seem to have problems if I only set mychoice/text, so I end up playing with mychoice/data as well. /data is a series and I set it to the position I want. I thought that was the solution but now I'm seeing some odd behavior with that too. I'm doing something a bit different since I'm not just setting a default at the start, but I'm updating the view after reading values from a database, but it's a similar idea. mike

 [3/3] from: mh983:usa at: 22-Mar-2002 23:34

Ok, just setting /text seems to be working for me now. In my case, I have a function that updates any choice, given an integer index read from the database. The current position in /data moves around based on what's selected, so you have to be sure you put 'head in there so that the index is always from the start of the 'data series; that's the part I was missing. Now this seems terribly unrelated to your question -- sorry. update-choice: func [ "sets the given choice to the value at the given index" the-choice index ][ ; set the text to the correct value for the index ; +1 to skip the "choose one..." option that I put at the ; beginning of every choice the-choice/text: pick head the-choice/data (index + 1) show the-choice ]