[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Adding Items to the Middle of a Menu
- To: info-mcl@cambridge.apple.com
- Subject: Adding Items to the Middle of a Menu
- From: Shannon V Spires <svspire@somnet.sandia.gov>
- Date: Tue, 8 Nov 1994 11:53:58 -0700 (MST)
- Cc: svspire@somnet.sandia.gov (Shannon V Spires)
- Full-name: Majordomo Mailing List Server
- In-reply-to: <9411080600.AA24032@cambridge.apple.com> from "info-mcl-digest-request@cambridge.apple.com" at Nov 8, 94 01:00:11 am
- Sender: owner-info-mcl@cambridge.apple.com
specht@cogpsy.Uni-Trier.de (Marcus Specht) writes:
> I have the same problem with the menu-items in a menu:
> (add-menu-items ... only adds them at the bottom, is there a way to add new
> menu-items at any place in the menu?
Here's one way to do it. This routine adds a menu item to position n
in an existing menu. I suspect a similar approach might do the job
for adding menus to the middle of the menu bar, but I haven't tried
that.
(defun install-item-at (menu item n)
"Add a new menu item in menu at position n."
(let ((afteritems (nthcdr (- n 1) (menu-items menu))))
(when afteritems
(apply #'remove-menu-items menu afteritems))
(apply #'add-menu-items menu item afteritems)))
(install-item-at *file-menu* your-new-item 10) ; put it just after the
; Revert item
--
Shannon Spires
Internet: svspire@sandia.gov
Voice: 505-844-4287
Fax: 505-844-3296