.. highlightlang:: us .. index:: MenuInsertCommands .. index:: Context menu .. index:: Pop-up menu .. _menuinsertcommands: MenuInsertCommands ================== .. us.tag MenuInsertCommands ENGLISH New300 Menu :ref:`MenuInsertCommands` inserts a new menu item to a pop-up menu. .. function:: bool = MenuInsertCommands(ssPopup, svCommands, nPos) .. us.return **Return Value** *bool*. .. us.params **Parameters** .. uparam:: ssPopup *ssPopup* is the name of a pop-up menu. A list of all pop-up menu names can be retrieved with the **MenuGetNames** function. Commands can be added to the following pop-up menus: .. list-table:: :header-rows: 0 * - OBJ_CB * - OBJ_EB * - OBJ_LAYER * - OBJ_LAYER-Autoscale * - OBJ_LAYER-Background * - OBJ_LAYER-X-Axis * - OBJ_LAYER-Y-Axis * - OBJ_LAYER-Z-Axis * - OBJ_LB * - OBJ_OLE * - OBJ_PAGE * - OBJ_PAGE-Export * - OBJ_RB * - OBJ_SYNEDITOR * - OBJ_TB * - OBJ_XY * - OBJ_XY-Cursor * - OBJ_XY-Multi * - OBJ_XY-New * - OBJ_XY-Text * - OBJ_XY-Transformation * - OBJ_XYZ * - OBJ_XYZ-CrossSection .. uparam:: svCommands *svCommands* is a function name or a vector of function names. Instead of a function name the name of a pop-up menu followed by an @-sign followed by the display text can be specified to add an pop-up menu to a context menu. :ref:`MenuCreatePopup` function is used to create the pop-up menu. See example. .. uparam:: nPos *nPos* specifies the insert position in the menu. To add an item at top set *nPos* = 1. To add the items at the end of the menu use a high number, for example 32000. .. us.example **Example** Add Menu item to the text object context menu:: MenuInsertCommands("OBJ_TB", [""; "MyLegendFunc"], 32000); MnSetCommand("MyLegendFunc", "Legende..."); Add pop-up menu to the context menu of a text object:: MenuCreatePopup("OBJ_TB-Legend", [.. "_Test1"; "_Test2"]); MenuInsertCommands("OBJ_TB", [""; "OBJ_TB-Legend@Legende"], 32000); MnSetCommand("_Test1", "Legende1..."); MnSetCommand("_Test2", "Legende2..."); .. seealso:: :ref:`overview-menus`, :ref:`MnSetCommand`, :ref:`MenuCreatePopup` :sub:`id-1504037`