help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:Re: widget-create 'menu-choice


From: Mortimer Cladwell
Subject: Re:Re: widget-create 'menu-choice
Date: Thu, 24 Sep 2009 09:13:14 -0700 (PDT)

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")
 
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.
Thanks
Mortimer
-----------------------------------------------------------------
Mortimer Cladwell wrote:
Hi,
I would like to dynamically populate a dropdown widget from a database. the 'menu-choice widget looks like
(widget-create 'menu-choice
:tag "Select Host Species"
:value "unknown"
:notify (lambda (widget &rest ignore)
(setq host-species (widget-value widget)))
'(item "human")
'(item "rat")
'(item "mouse"))
Suppose I can generate a list '( "human "rat" "mouse") from the database. How to create
'(item "human")
'(item "rat")
'(item "mouse")
on the fly? The closest I can come is
(progn
(setq var '( "human" "rat" "mouse"))
(mapcar '(lambda (a) `'(item ,a)) var)
)

i.e.

(let ((var '("human" "rat" "mouse")))
  (mapcar (lambda (label) (list 'item label))
          var))

--
Kevin Rodgers
Denver, Colorado, USA


reply via email to

[Prev in Thread] Current Thread [Next in Thread]