(apply 'widget-create 'menu-choice....
Will create multiple dropdown lists. I want a single dropdown that has
multiple elements. I am thinking a macro is the way to go. Consider:
(defmacro item-element (var)
(list 'quote `'(item ,var)))
Then (item-element "human") would evaluate to (quote (item "human"))
What I haven't been able to do is mapcar item-element over my list
("rat" "human" "mouse")
The desired output is:
(quote (item "rat")) (quote (item "human")) (quote (item "mouse"))
Note the absence of circumscribed parenthesis, i.e. this is not a list.
Suggestions?
Thanks
Mortimer
----------------------------------------------------------
Mortimer Cladwell
wrote:
Your suggestion evaluates to:
((item "human") (item "rat") (item "mouse"))
which when inserted into a form results in the error:
widget-create: Invalid function: (item "human")
Ah, I misread the widget-create arguments. That function's doc string is
practically useless.
Evaluations that would work are:
'(item "human") '(item "rat") '(item "mouse")
OR
(quote (item "human")) (quote (item "rat")) (quote (item "mouse"))
>
Note that there are no enclosing parenthesis around the list.
As Andreas points out, you need apply:
(defvar species '("human" "rat" "mouse"))
(apply 'widget-create
'menu-choice
:tag "Select Host Species"
:value "unknown"
:notify (lambda (widget &rest ignore)
(setq host-species (widget-value widget)))
(mapcar (lambda (label) (list 'item label))
species))
--
Kevin Rodgers
Denver, Colorado, USA