MnInsert

MnInsert inserts a new item into a menu.

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)

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.

nCommandID

nCommandID is the identification number of a menu item. A unique nCommandID can be created using the function MnGetNewCommandID. If you want to insert a menu item into the main menu set nCommandID to 0. Example: MnInsert("Main", 2, 0, "My Menu");.

nItem

nItem is the position of the menu within the menu*nMenu*.

ssMenuString

ssMenuString is the menu item text displayed in the menu.

nFlag

nFlag is one of the following values:

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.

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.

Example

MnSetCommand(99, "Test()");

id-1834485