I want to display a bunch of stuff, and let a person select one of them. I am looking through the documentation and it looks like a text-list might be the item for that. I see how to fill a text-list, and one can click the mouse on an item in a text-list, but can one then get the item that was selected? I wrote a demo based on the documentation. I am looking for the line of code to reference the item selected in the text list. Thank you. REBOL [ ] SHOW-SELECTED: does [ ;; ;; How do I, or can I, get the item in the text-list ;; ;; that was selected? SELECTED-ITEM/text: FILE-NAMES/value ;; this does not work ;; ;; show SELECTED-ITEM ] view layout [ vh2 "File List:" FILE-NAMES: text-list data read %. button "Show selected" [SHOW-SELECTED] SELECTED-ITEM: text "" ]
The selected lines are in FILE-NAMES/picked. Try this: Code: REBOL [] SHOW-SELECTED: does [ SELECTED-ITEM/text: mold FILE-NAMES/picked ;; this does work, but might need soem formatting show SELECTED-ITEM ] unview/all view layout [ vh2 "File List:" FILE-NAMES: text-list data read %. button "Show selected" [SHOW-SELECTED] SELECTED-ITEM: text 200x200 "" ] Note that to pick multiple lines, you have to hold down the CTRL key and click.
there is the "picked" refineiment, see this: Code: view layout [ a: text-list "Red" "Green" "Blue" [print a/picked] ]