MnSetCommandΒΆ
MnSetCommand assigns a UniScript command to a menu item.
- bool = MnSetCommand(ssCommand, ssMenuText)
- bool = MnSetCommand(nCommandID, ssCommand)
- bool = MnSetCommand(nCommandID, ssCommand, ssToolTip)
- bool = MnSetCommand(nCommandID, ssCommand, ssToolTip, ssStatusBarText)
- bool = MnSetCommand(nCommandID, ssCommand, ssToolTip, ssStatusBarText, ssMenuText, ssCategory, ssBitmapFile)
Return Value
If the function succeeds, the return value bool is TRUE (1); otherwise it is FALSE (0).
Parameters
- nCommandID
nCommandID is the identification number of a menu item. A unique nCommandID can be created using the function MnGetNewCommandID.
- ssCommand
ssCommand is the function name that will be called when the menu item is selected.
- ssMenuText
ssMenuText is a string with the item text. This parameter is only used for pop-up menus (right mouse click).
- ssToolTip
Is a tip text displayed when the mouse cursor is above the button. The tip text can contain newline characters
\n.
- ssStatusBarText
Is the text displayed in the status bar if the mouse cursor is above the button.
- ssCategory
The parameter ssCategory is used to organize the commands. The category name will be displayed in the customizing dialog box Tools=>Customize User Toolbar.
- ssBitmapFile
Is the complete name including the path of a bitmap file: If only the file name (e.g.
spline.bmp) is specified the bitmap must be located in the directoryUniPlot\bitmap. The width of the Bitmap should be 16 pixel and the height should be 15 pixel and should be saved as an 256 color bitmap.
Example
nID = MnGetNewCommandID()
MnAppend("Editor", 4, nID, "Show Version Info")
MnSetCommand(nID, "ShowVersionInfo");
MnDrawMenuBar()
def ShowVersionInfo()
{
MessageBox("Version: " + version());
}
See also
Overview Menus, MnAppend, MnInsert, MnGetNewCommandID, MnDrawMenuBar, RegisterCommand
id-1510899