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

[REBOL] Natural selection

From: philb:upnaway at: 13-Jul-2003 21:45

Hi Partrick, This is not exactly compatible .... and pretty ugly. This program stores a record number with each line (beyond the end of the list so we cant see it), and creates a picked block with the list. This picked block holds the count field rather than the picked text's. On selecting the record we check to see if it is in the picked list, if not add it, else remove it. Two changes have been made to supply 1. Store the count in the field rec-no. 2. check to see if count is in the picked list ... if so highlight the text face. ------------------------------------------------------------------------------- mydata: ["Red" "Green" "blue"] view center-face layout [ mylist: list 200x100 [ across text 200 [ either none = lv-temp: find mylist/picked to-integer rec-no/text [mylist/picked: append mylist/picked to-integer rec-no/text] [remove lv-temp] ] rec-no: text 1 ] with [picked: copy []] supply [ face/text: either count > length? mydata [""][pick mydata count] rec-no/text: count either (find mylist/picked count) <> none [face/color: brick] [face/color: none] ] ] -------------------------------------------------------------------------- As I said pretty ugly, but it works. You do have access to the indicies of the picked records, and this method doesnt suffer from the duplicate selection "feature" of text-lists. Cheers Phil === Original Message === Hi list, Text-lists have build-in selection capabilities. The selected items being available in list-name/picked. Is it possible to get the selection capabilitie whith list ? This kind of list: mydata: ["Red" "Green" "blue"] view center-face layout [ mylist: list 200x100 [ text 80 ] supply [ face/text: either count > length? mydata [""][pick mydata count] ] ] Regards Patrick