.. highlightlang:: us .. index:: RegisterCommand .. _registercommand: RegisterCommand =============== .. us.tag RegisterCommand ENGLISH Menu Toolbar New300 :ref:`RegisterCommand` adds a new command to the command table for the User Toolbar. The registered commands can be added to the ToolBar using the command :ref:`tools-customize-user-toolbar`. .. function:: bool = RegisterCommand(ssCategory, ssFunctionName, ssButtonText) bool = RegisterCommand(ssCategory, ssFunctionName, ssButtonText, ssTipText) bool = RegisterCommand(ssCategory, ssFunctionName, ssButtonText, ssTipText, ssStatusbarText) bool = RegisterCommand(ssCategory, ssFunctionName, ssButtonText, ssTipText, ssStatusbarText, ssBitmap) .. us.return **Return Value** If the function succeeds, the return value is TRUE (1); otherwise it is FALSE (0). .. us.params **Parameters** .. 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:: ssFunctionName *ssFunctionName* is the name of the function which will be called if the user selects the corresponding button on the user tool bar. This function should not have any parameters. The function name is given without parentheses ``"()"``. .. uparam:: ssButtonText The button text is placed to the right of the bitmap. The text should be as short as possible. .. uparam:: ssTipText Is a tip text displayed when the mouse cursor is above the button. The tip text can contain newline charaters ``\n``. .. uparam:: ssStatusbarText Is the text displayed in the statusbar if the mouse cursor is above the button. .. uparam:: ssBitmap 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 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. The bitmap can be created using the program paint that comes with windows: .. image:: S:/uniplot-obj/images/UserToolbar_EditBitmap-en.* .. us.comment **Comment** The commands can be added to the user toolbar in the dialogbox :ref:`tools-customize-user-toolbar`. The function invokes :ref:`MnSetCommand`. .. us.example **Example** The following example shows how a simple function for the user toolbar is defined and registered. :: RegisterCommand("2D-Datensatz", "MyScaleFunc", "2D-My Scaling"); def MyScaleFunc() { hvHandle = GetActiveXYHandles(); // defined in ic_util.ic if (hvHandle[1] == 0) { return; } rmXY = XYGetData(hvHandle[4]); rmXY[;2] = rmXY[;2] * 1.034 + 0.123; XYSetData(hvHandle[4], rmXY[;1], rmXY[;2]); } .. seealso:: :ref:`tools-customize-user-toolbar`, :ref:`overview-menus`, :ref:`MnAppend`, :ref:`MnInsert`, :ref:`MnGetNewCommandID`, :ref:`MnDrawMenuBar`, :ref:`MnSetCommand`, :ref:`UserBar_Add` :sub:`id-495901`