.. highlightlang:: us .. index:: MnInsertPopup .. _mninsertpopup: MnInsertPopup ============= .. us.tag MnInsertPopup ENGLISH Menu New5100 :ref:`MnInsertPopup` inserts a new popup menu into a menu. .. function:: bool = MnInsertPopup(ssMenu, nMenu, nItem, ssMenuString, ssPopupName) .. 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:: nItem *nItem* is the position of the menu within the menu *nMenu*. -1 appends the menu to the end. .. uparam:: ssMenuString *ssMenuString* is the name of the menu item. .. uparam:: ssPopupName *ssPopupName* is the name of a menu created with :ref:`MenuCreatePopup`. .. us.example **Example** The following example could be saved in an ic file int the UniPlot autoload directory:: // Only one function specified in this example def MyFunc1() { MessageBox("In MyFunc1"); } def MenuTest() { RegisterCommand("2D-Dataset", "MyFunc1", "2D-My Function 1"); RegisterCommand("2D-Dataset", "MyFunc2", "2D-My Function 2"); RegisterCommand("2D-Dataset", "MyFunc3", "2D-My Function 3"); RegisterCommand("2D-Dataset", "MyFunc4", "2D-My Function 4"); RegisterCommand("2D-Dataset", "MyConfig", "Configuration...."); MenuCreatePopup("MyFunction", [.. "Group1@ My Group1"; "Group2@ My Group2"; ""; "MyConfig"]); MenuCreatePopup("Group1", [.. "MyFunc1"; ""; "MyFunc2"]); MenuCreatePopup("Group2", [.. "MyFunc3"; "MyFunc4"]); // Insert into the Tools menu of a IPW document : svStrings = MnGetStrings("Document"); iPos = findfirst(svStrings == "&Tools"); if (iPos != 0) { MnInsertPopup("Document", iPos, 3, "My Function", "MyFunction"); } else { // Tools not found, insert in menu 2 MnInsertPopup("Document", 2, 3, "My Function", "MyFunction"); } MnDrawMenuBar(); } MenuTest() .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - 5.10.0 - New .. seealso:: :ref:`overview-menus`, :ref:`MnAppend`, :ref:`MnRemove` :sub:`id-1557536`