MnInsertPopup

MnInsertPopup inserts a new popup menu into a menu.

bool = MnInsertPopup(ssMenu, nMenu, nItem, ssMenuString, ssPopupName)

Return Value

If the function succeeds, the return value bool is TRUE (1).If the function fails, the return value is FALSE (0).

Parameters

ssMenu

ssMenu is the name of the menu bar. The following menus are available:

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.
nMenu

nMenu is the position of the menu. The entry that lies farthest left (normally the File Menu) has the position 1.

nItem

nItem is the position of the menu within the menu nMenu. -1 appends the menu to the end.

ssMenuString

ssMenuString is the name of the menu item.

ssPopupName

ssPopupName is the name of a menu created with MenuCreatePopup.

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()

History

Version Description
5.10.0 New

id-1557536