.. highlightlang:: us .. index:: MnSetCommand .. _mnsetcommand: MnSetCommand ============ .. us.tag MnSetCommand ENGLISH Menu Changed300 :ref:`MnSetCommand` assigns a UniScript command to a menu item. .. function:: 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) .. us.return **Return Value** If the function succeeds, the return value *bool* is TRUE (1); otherwise it is FALSE (0). .. us.params **Parameters** .. uparam:: nCommandID *nCommandID* is the identification number of a menu item. A unique *nCommandID* can be created using the function :ref:`MnGetNewCommandID`. .. uparam:: ssCommand *ssCommand* is the function name that will be called when the menu item is selected. .. uparam:: ssMenuText *ssMenuText* is a string with the item text. This parameter is only used for pop-up menus (right mouse click). .. uparam:: ssToolTip Is a tip text displayed when the mouse cursor is above the button. The tip text can contain newline characters ``\n``. .. uparam:: ssStatusBarText Is the text displayed in the status bar if the mouse cursor is above the button. .. uparam:: ssCategory The parameter *ssCategory* is used to organize the commands. The category name will be displayed in the customizing dialog box :ref:`tools-customize-user-toolbar`. .. uparam:: ssBitmapFile Is the complete name including the path of a bitmap file: If only the file name (e.g. :file:`spline.bmp`) is specified the bitmap must be located in the directory :file:`UniPlot\\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. .. us.example **Example** :: nID = MnGetNewCommandID() MnAppend("Editor", 4, nID, "Show Version Info") MnSetCommand(nID, "ShowVersionInfo"); MnDrawMenuBar() def ShowVersionInfo() { MessageBox("Version: " + version()); } .. seealso:: :ref:`overview-menus`, :ref:`MnAppend`, :ref:`MnInsert`, :ref:`MnGetNewCommandID`, :ref:`MnDrawMenuBar`, :ref:`RegisterCommand` :sub:`id-1510899`