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

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

Re: widget-create 'menu-choice


From: Kevin Rodgers
Subject: Re: widget-create 'menu-choice
Date: Thu, 24 Sep 2009 20:59:39 -0600
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

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





reply via email to

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