.. highlightlang:: us .. index:: MnInsert .. _mninsert: MnInsert ======== .. us.tag MnInsert ENGLISH Menu :ref:`MnInsert` inserts a new item into a menu. .. function:: bool = MnInsert(ssMenu, nMenu, nCommandID, ssMenuString) bool = MnInsert(ssMenu, nMenu, nCommandID, ssMenuString, nFlag) bool = MnInsert(ssMenu, nMenu, nItem, nCommandID, ssMenuString) bool = MnInsert(ssMenu, nMenu, nItem, nCommandID, ssMenuString, nFlag) .. us.return **Return Value** If the function succeeds, the return value *bool* is TRUE (1).If the function fails, the return value is FALSE (0). .. us.params **Parameters** .. uparam:: ssMenu *ssMenu* is the name of the menu bar. The following menus are available: .. list-table:: :header-rows: 1 * - Value - Meaning * - "Editor" - This menu appears when an editor is active. * - "Document" - This menu appears when a document with diagram pages is active. * - "DocumentServer" - This menu appears when the UniPlot document page is embedded in another application program (OLE). * - "Command" - This menu appears when the UniScript command window is active. * - "Main" - This menu appears when no MDI window is available in UniPlot's main window. This is normally the case after UniPlot has be started. .. uparam:: nMenu *nMenu* is the position of the menu. The entry that lies farthest left (normally the File Menu) has the position 1. .. uparam:: nCommandID *nCommandID* is the identification number of a menu item. A unique *nCommandID* can be created using the function :ref:`MnGetNewCommandID`. If you want to insert a menu item into the main menu set *nCommandID* to 0. Example: ``MnInsert("Main", 2, 0, "My Menu");``. .. uparam:: nItem *nItem* is the position of the menu within the menu*nMenu*. .. uparam:: ssMenuString *ssMenuString* is the menu item text displayed in the menu. .. uparam:: nFlag *nFlag* is one of the following values: .. list-table:: :header-rows: 1 * - Value - Meaning * - MF_SEPARATOR - Draws a horizontal dividing line. * - MF_MENUBARBREAK - Places the item on a new line in static menus or in a new column in pop-up menus. The new pop-up menu column will be separated from the old column by a vertical dividing line. * - MF_MENUBREAK - Places the item on a new line in static menus or in a new column in pop-up menus. No dividing line is placed between the columns. .. us.example **Example** The following is an example of a function to be executed when a menu point is activated: :: def Test() { MessageBox("Menu Test selected!"); } Next a menu item will be attached to the end of the document menu. :: nID = MnGetNewCommandID() MnInsert("Document", 2, nID, "&Test"); Call the following function to update the menu, :: MnDrawMenuBar(); Next we assign assign the UniScript function test() to a menu item. .. us.example **Example** :: MnSetCommand(99, "Test()"); .. seealso:: :ref:`overview-menus`, :ref:`MnAppend`, :ref:`MnRemove`, :ref:`MnDrawMenuBar`, :ref:`MnSetCommand`, :ref:`MnInsertPopup` :sub:`id-1834485`