|
IDL Connectivity Bridges: Creating Custom COM Export Objects |
|
This drawable object example inherits from IDLgrWindow and creates a histogram plot for a selected monochrome or RGB image file. While this example does contain several custom methods including those for opening a file, creating the plots, and changing plot characteristics, it does not use keyboard or mouse events. See COM IDLitWindow Surface Manipulation for such an example.
| Example Code The object definition file, export_grwindow_doc__define.pro is located in the examples/doc/bridges subdirectory of the IDL distribution. |
Complete the following steps to duplicate this example.
.EDIT export_grwindow_doc__define.pro 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. oPlotWindow = OBJ_NEW("export_grwindow_doc") oPlotWindow->CHANGELINE, 2This will display a three channel histogram plot and change the plot linestyle to dashed. |
New Project
COM and browse to select export_grwindow_doc__define.pro. Click Open to load the file into the Export Assistant.
| 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. |
| Note Set the Export parameter to True for all items in this list unless otherwise noted. |
| Tip You can select multiple items in the tree view and set properties for the group. |
Save project. Accept the default name and location or make changes as desired.
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.
ocx using regsvr32 export_grwindow_doc.ocx. See COM Registration Requirements for details if needed.
export_grwindow_doc Class file to the toolbox. Select View
Toolbox and select the desired tab. Right-click and select Add/Remove Items. Click on the COM Components tab, place a checkmark next to the class file and click OK.
export_grwindow_doc control to your form.
| Example Code The text file for this example, com_export_grwindow_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. |
After building and running the project, a Windows application interface will display a histogram plot of an RGB image. You can change the linestyle of the plot by making a selection from the listbox. You can also create a histogram plot for a new image by clicking the button.
IDL Online Help (March 06, 2007)