RegisterCommandΒΆ

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 Tools=>Customize User Toolbar.

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)

Return Value

If the function succeeds, the return value is TRUE (1); otherwise it is FALSE (0).

Parameters

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.

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

ssButtonText

The button text is placed to the right of the bitmap. The text should be as short as possible.

ssTipText

Is a tip text displayed when the mouse cursor is above the button. The tip text can contain newline charaters \n.

ssStatusbarText

Is the text displayed in the statusbar if the mouse cursor is above the button.

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 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:

../../_images/UserToolbar_EditBitmap-en.png

Comment

The commands can be added to the user toolbar in the dialogbox Tools=>Customize User Toolbar. The function invokes MnSetCommand.

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]);
}

id-495901