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

[REBOL] Re: series/text-list position

From: antonr:iinet:au at: 14-Nov-2003 12:27

Try this: view layout [t: text-list "hello" "there" "hello" "anton"] (Now click on the first item)
>> t/picked
== ["hello"]
>> t/data
== ["hello" "there" "hello" "anton"]
>> find t/data t/picked/1
== ["hello" "there" "hello" "anton"]
>> index? find t/data t/picked/1
== 1 One problem with text-lists is that if you have more than one item with an equal value, then when you pick one, the other ones will also be picked. So it's good/necessary to ensure you have unique values in your text-list. eg. This list is problematic: hello there hello anton If you pick the first "hello", the second one will also be shown as selected, and vice versa, if you pick the second one, the first one is also shown as selected. This means that if your values are not unique, then it is difficult to find the index in the series by using: index? find series value because you may have intended only the second value to be picked. A possible solution is to ensure your values are unique by adding an index number to the beginning of each string (or a number of invisible whitespaces at the end of secondary instances of values). Anton.