[REBOL] Re: newbie q : value & label in text-lists
From: carl:cybercraft at: 31-Mar-2004 13:39
On 31-Mar-04, [sags--apollo--lv] wrote:
> Hi, List!
> I would like to set up text-list in my layout, so it
> shows just labels, but when selected I could get
> value.
> Like in HTML forms:
> <OPTION SELECTED VALUE="ID">Label 1</OPTION>
> I tried some variants by using data blocks, but not
> yet success.
face/lines provides an index to which line in the list has just been
clicked on, so that can be used as a pointer to your data. There's
also a face/user-data which could be used to store your values.
Using this approach, you could have something like this...
REBOL []
my-labels: [
"ten"
"eleven"
"twelve"
"thirteen"
"fourteen"
"fifteen"
"sixteen"
"seventeen"
"eighteen"
"nineteen"
]
my-data: [10 11 12 13 14 15 [this is number 16] 17 18 19]
view layout [
text-list 200x70 data my-labels user-data my-data [
probe pick face/user-data index? face/lines
]
]
(The [this is number 16] is just to show you you could have any data
you like in my-data.)
HTHs.
--
Carl Read