Defining the OLE object

You define the OLE object in the Insert Object dialog box. It has three tab pages:

If you want to

Select this tab page

Embed an OLE server object in the DataWindow object

Create New

Link or embed the contents of an existing file as an OLE object so that it can be activated using the application that created it

Create From File

Insert an ActiveX control in the DataWindow object

Insert Control

This section contains procedures for each of these selections.

Create New

Use the following procedure if you want to embed a new OLE server object.

StepsTo embed a new OLE server object using the Create New tab:

  1. Select the Create New tab.

  2. In the Object Type box, highlight the OLE server you want to use.

    You can click Browse to get information about the server from the registry.

  3. Optionally display the OLE object as an icon by doing one of the following:

    • Check Display as Icon to display the server application’s default icon in the control.

    • Check Display as Icon and then select Change Icon to supply a nondefault icon and icon label.

  4. Click OK.

    The OLE object is inserted in your DataWindow object and the OLE server is activated. Depending on the OLE server and whether or not you have already specified how the OLE object will use the DataWindow object’s data, the object may be empty or may show an initial presentation of the OLE object. Close the server application and, if you are inserting an OLE object in a DataWindow object, specify the object’s properties (see “Specifying properties for OLE objects”).

Create From File

Use the following procedure if you want to link or embed the contents of an existing file as an OLE object so that it can be activated using the application that created it. Most of the steps in this procedure are the same as those for embedding a new OLE server object.

NoteA server application must be available You (and the user) must have an application that can act as a server for the type of object you link or embed. For example, if you insert a BMP file, it displays because an application that can handle bitmaps is installed with Windows. If you insert a GIF or JPEG file, it displays only if you have a third-party graphics application installed.

StepsTo link or embed an existing object using the Create From File tab:

  1. Select the Create From File tab.

  2. Specify the file name in the File Name box. If you do not know the name of the file, click the Browse button and select a file in the dialog box.

  3. To create a link to the file, rather than embed a copy of the object in the control, select the Link check box.

  4. Click OK.

    The OLE object is inserted in your DataWindow object and the OLE server is activated. Depending on the OLE server and whether or not you have already specified how the OLE object will use the DataWindow object’s data, the object might be empty or might show an initial presentation of the OLE object. Close the server application and, if you are inserting an OLE object in a DataWindow object, specify the object’s properties (see “Specifying properties for OLE objects”).

Insert Control

Use the following procedure if you want to insert an ActiveX control (OLE custom control) in the DataWindow object.

StepsTo insert an ActiveX control using the Insert Control tab:

  1. Select the Insert Control tab.

  2. In the Control Type box, highlight the ActiveX control you want to use, or, if the ActiveX control you want has not been registered, click Register New.

    If you select an existing ActiveX control, you can click Browse to get more information about it. ActiveX controls are self documenting. PowerBuilder gets the property, event, and function information from the ActiveX control itself from the registry.

    If you click Register New, you are prompted for the file that contains the registration information for the ActiveX control.

  3. Click OK.

  4. If you did not specify how the OLE object will use the DataWindow object’s data when you created the DataWindow object, do so on the Data property page.

    If you have inserted an ActiveX control that does not display data, such as the Clock control, you do not need to transfer data to it.

    For more information, see “Specifying data for the OLE object”.

Specifying properties for OLE objects

For OLE objects, you need to specify how the OLE object will use the DataWindow object’s data. If you used the OLE presentation style, you did this when you created the DataWindow object.

If you are inserting an OLE object in an existing DataWindow object, you can also associate the object with the current row. If you are using the OLE presentation style, the OLE object is always associated with all rows.

StepsTo specify properties for an OLE object:

  1. Select the Data property page in the Properties view.

  2. Specify how the OLE object will use the DataWindow object's data.

    For more information, see “Specifying data for the OLE object”.

  3. (Optional) To associate the object with the current row, select the Position property page and change the value in the Layer box to Band.

  4. Click OK when you have finished.