Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version

## add-to-menu

Arguments: menu menu-item &key position after (at-end t)

Adds menu-item to menu at a specified position among the current menu-items or after a menu-item given as the value of after. at-end is obsolete (use `:position :end`).

Returns the menu-item that was passed in after adding it to menu.

The arguments are:

- menu: may be any menu, whether a `menu-bar`, `pop-up-menu`, or `pull-down-menu`.
- menu-item: should be a `menu-item`.
- position: may be either `:start`, `:end`, or a non-negative integer. `:start` adds the menu-item at the top of the menu. `:end` adds it at the bottom. An integer indicates an index into the list of menu-items, where zero indicates the top of the menu and any integer equal to or greater than the number of menu-items presently in the menu indicates the bottom.
- after: may be either `nil` or a menu-item that is presently in the menu or the name of such a menu-item. If true and the menu-item is found in the menu, then the new menu-item is placed just below the after menu-item.

The position of the menu-item is determined by the after argument if it specifies a menu-item that is present in menu, and otherwise by the position argument. Note that a menu-item should only be added to one menu. If a similar menu-item must appear in more than one menu, create copies (by calling `(make-instance 'menu-item)` with identical arguments or with copy-menu-item) as necessary.

See also open-menu.

Backward compatibility note: All releases after 5.0 replace the at-end argument with the position and after arguments, but at-end will still work for backward compatibility. If at-end is true (and position and after are unspecified), then the menu-item is placed at the bottom of the menu, and otherwise at the top. at-end should not be specified simultaneously with either position or after; an error will be signaled if this is done.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version