bitmapEditor() - obsolete

This function opens the bitmap editor. To be able to use the function, the PVSSBitmapEditor.dll has to exist in the directory <version_path>/bin (obsolete from version 3.5 up).

Synopsis

int bitmapEditor(idispatch &bitmap[, int &result][, dyn_string colors][, dyn_int size]])

Parameters

Parameter Meaning
bitmap An image in OLE format
result

1 = OK: Bitmap was changed with the editor.

2 = Cancel: Bitmap was changed with the editor.

3 = OK: Bitmap is unchanged.

4 = Cancel: Bitmap is unchanged.

colors The colors that can be selected in the editor's color selector. If this parameter is not specified, all colors are available.
size Bitmap size (if the bitmap is empty)

Return Value

In case of an error -1, otherwise 0

Errors

Missing or wrong arguments

Description

The function opens the bitmap editor and creates a bitmap. The bitmap is saved in PROJ_PATH+"pictures/bitmapeditortest.bmp"

Example

main()
{
  // bitmap in IPictureDisp
  idispatch ipicture;
  /* the colors that are available in the bitmap editor (see also
  bitmapEditor() )
  */
  dyn_string colors = makeDynString("red", "green", "blue");
  // Default Bitmap size
  dyn_int size = makeDynInt(100, 100);
  // Rückgabewert
  int retVal;
  string filename;
  // Open the file selector
  fileSelector(filename, PROJ_PATH+"pictures"); /* writes the path
  PROJ_PATH+"pictures" into the variable filename */
  if (filename != "")
  {
    /*Loads a picture from the PROJ_PATH+"pictures directory into
    the variable 'ipicture'. If an image does not exist, an image is
    created via the bitmap editor */
    ipicture = OLEPicture(filename);
  }
  else
  {
    //A new image (100x100 Pixels)is created via the bitmap
    editor
  }
  while (true)
  {
    /* open the bitmap editor and create the image. The image is
    saved in the variable ipicture */
    if (bitmapEditor(ipicture, colors, size, retVal) != 0)
    {
      // missing or wrong parameters
      return;
    }
    if (retVal < 1 || retVal > 4)
    {
      // PVSSBitmapEditor.dll was not found
      return;
    }
    else if (retVal == 1) // OK, image changed
    {
      string filename = PROJ_PATH+"pictures/bitmapeditortest.bmp";
      //save the bitmap underbitmapeditortest.bmp
      OLEPictureSave(ipicture, filename);
      // ready
      break;
    }
    else if (retVal == 2) //check if the image was changed
    {
      dyn_float df;
      dyn_string ds;
      string ret;
      ChildPanelOnCentralModalReturn("vision/MessageInfo3", "",
      makeDynString("$1:Save the changes?", "$2:Yes", "$3:No",
      "$4:Cancel"), df, ds);
      ret = ds[1];
      if (ret == "true")
      {
        string filename;
        fileSelector(filename, PROJ_PATH+"pictures");
        if (filename != "")
        {
          OLEPictureSave(ipicture, filename);
          break;
        }
      }
      else if (ret = "false")
      {
        break;
      }
      else //if (ret == "Cancel")
      {
        //continue;
      } 
    }
    else if (retVal == 3) // ok, image unchanged
    {
      break;
    }
    else if (retVal == 4) // cancel, image unchanged
    {
      break;
    }
  }
}

Assignment

Graphic functions

Availability

UI

See also

OLEPictureSave()