This drawable object example inherits from IDLitWindow and creates an ISURFACE display in a COM control. A listbox in a Visual Basic .NET Windows application is populated with manipulator string values that, when selected, allow you to draw annotations, rotate, or zoom within the exported IDLitWindow control. Avoid exposing any manipulator that has an associated widget interface (such as a profile line manipulator) since such widget functionality is not supported in objects that subclass from IDLitWindow.

Example Code

The object definition file, export_itwinmanip_doc is located in the examples/doc/bridges subdirectory of the IDL distribution. Run the example procedure by entering export_itwinmanip_doc define at the IDL command prompt or view the file in an IDL Editor window by entering:

.EDIT export_itwinmanip_doc

Complete the following steps to duplicate this example:

  1. In an IDL Editor window, open the object definition file by entering
  2. .EDIT export_itwinmanip_doc

    at the command prompt.

    Note: It is a good idea to test the functionality of an object before exporting it. After compiling the file, enter the following lines at the command line and make sure the output is what is expected for this object.
    oWin = OBJ_NEW("export_itwinmanip_doc")
    oWin->CHANGEMANIPULATOR, "annotation/oval"
    This will let you draw a oval annotation in the window. If you press the Delete key, the annotation will be removed. The available manipulator strings are printed in the IDL output window.

  3. Open the Export Bridge Assistant by entering IDLEXBR_ASSISTANT at the command line.
  4. Select to create a COM export object by selecting File > New Project > COM and browse to select Click Open to load the file into the Export Assistant.
  5. Note: Export Bridge Assistant details are available in Specifying Information for Exporting. Refer to that section if you need more information about the following items.

  6. Set export object characteristics as described in the following table. When you select the tree view item listed in the left column, configure the related properties as noted in the right column.
  7. Tree View Item

    Property Configuration

    IDL Export Bridge Project

    Accept the default value or make changes as desired:

    • Output classname
    • Process name
    • Output directory


    Drawable object equals True


    Enter different name if desired and mark Export as True

    MANIPID argument

    Mutability: In

    Type: BSTR

    Array: False

    Export: True

  8. Save the project by selecting File > Save project. Accept the default name and location or make changes as desired.
  9. Verify that the object elements you want to export are listed in the Export log panel. If the expected items are not present, one or more items may still have an UNSPECIFIED field value that must be changed.
  10. Build the export object by selecting Build > Build object. The Build log panel shows the results of the build process. For a drawable object, .tlb and .ocx files (named based on the object name) are created in the Output directory.
  11. Register the .ocx using regsvr32 export_itwinmanip_doc.ocx. See COM Registration Requirements for details if needed.
  12. Create a new Visual Basic .NET Windows Application and add the export_itwinmanip_doc Class file to the toolbox. Select View > Toolbox and select the desired tab. Right-click and select Add/Remove Items. Select the COM Components tab, place a checkmark next to the class file, and click OK.
  13. Add the IDL export_itwinmanip_doc control to your form.
  14. Replace the default form code with the text in the file referenced below. See code comments for details.

Note: The text file for this example, com_export_itwinmanip_doc.txt, is located in the examples/doc/bridges/COM subdirectory of the IDL distribution. This Visual Basic .NET code can be copied from the text file and adopted for use in your COM environment.

Note: This example exposes keyboard events. The value of the Delete key and other standard keys are described in Mouse and Keyboard Events in COM Export Objects.

Build and run the project. Select a manipulator from the listbox to use it in the IDLitWindow display. If you press the Delete key while visualizations are selected, they will be removed from the view.