[Top][All Lists]

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

Very customizable menus

From: David L. Brown
Subject: Very customizable menus
Date: 1 Feb 2003 09:26:51 -0800

I'm a novice at Lisp, but I'm learning.  There is something I can't
wrap my brain around, though.  Is it possible to take the values from
an alist, then populate a menu with the keys of the alist, and when
the button is clicked, a function is performed with the value of the
alist as a parameter?

So, I figured out the following fairly easily:

(defvar my-alist '(("key1" . "value1") ("key2" . "value2") ...)))

(defun my-function (key)
  ; do stuff with my-alist to get the value that goes with key and do

(add-submenu nil '("DoFunc"))

But now I'm trying to figure out the following

(defun regenerate-menu ()
  (dolist (item my-alist)
     ; grab the key and value from item and do something akin to
     ; (add-submenu '("DoFunc")
     ;              '("Keys" [key1  (my-function key1)]
     ;                       [key2  (my-function key2)]
     ;                        etc ...                 ]))

Is this possible?  Any assistance would be greatly appreciated

reply via email to

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