+Map
is normally used with the combo box version of the text fields. +Map
does a two-way translation and uses a list of cons pairs for lookup. The values in the CARs are displayed in the GUI and are mapped internally to the values in the CDRs. The following code displays "One", "Two" and "Three" to the user but uses 1, 2 and 3 internally.
(app)
(action
(html 0 "+Map" "@lib.css" NIL
(form NIL
(gui '(+Map +TextField)
'(("One" . 1) ("Two" . 2) ("Three" . 3))
'("One" "Two" "Three") )
(gui '(+Button) "Print"
'(msg (val> (field -1))) ) ) ) )
See also +Fmt, +TextField.