Setting up the OLE control

When you create an OLE control and insert an object, PowerBuilder activates the server application to allow you to modify the object. After you deactivate it (by clicking outside the object’s borders in the Layout view), you can use the control’s property sheets to set up the control.

StepsTo specify the control’s appearance and behavior:

  1. Double-click the control, or select Properties from the control’s pop-up menu.

  2. In the Properties view, give the control a name that is relevant to your application.

    You will use this name in scripts. The default name is ole_ followed by a number.

  3. Specify a value for Display Name for use by the OLE server. The OLE server can use this name in window title bars.

  4. Specify the control’s appearance and behavior by choosing appropriate settings in the Properties view.

    In addition to the standard Visible, Enabled, Focus Rectangle, and Border properties, which are available for most controls, there are several options that control the object’s interaction with the server:

    Option

    Meaning

    Activation

    How the user activates the control.

    Options are:

    • Double Click – When the user double-clicks the control, the server application is activated.

    • Get Focus – When the user clicks or tabs to the control, the server is activated. If you also write a script for the GetFocus event, do not call MessageBox or any function that results in a change in focus.

    • Manual – The control can be activated only programmatically with the Activate function.

    The control can always be activated programmatically, regardless of the Activation setting.

    Display Type

    What the control displays.

    Options are:

    • Contents – Display a representation of the object, reduced to fit within the control.

    • Icon – Display the icon associated with the data. This is usually an icon provided by the server application.

    • ActiveX document – Display as an ActiveX document. ActiveX documents fill the space of the container and have access to all the features of the server application.

    Contents

    What the user can insert in the control at runtime.

    Options are:

    • Any – The user can insert either a linked or embedded object.

    • Embedded – The user can insert an embedded object.

    • Linked – The user can insert a linked object.

    Setting Contents changes the value of the ContentsAllowed property.

    Link Update

    When the object in the control is linked, the method for updating link information.

    Options are:

    • Automatic – If the link is broken and PowerBuilder cannot find the linked file, it displays a dialog box in which the user can specify the file.

    • Manual – If the link is broken, the object cannot be activated. You can re-establish the link in a script using the LinkTo or UpdateLinksDialog function.

    Setting Link Update changes the value of the LinkUpdateOptions property.

    Size Mode

    How the object is displayed in the container.

    Options are:

    • Clip – The object’s image displays full size. If it is larger than the OLE control, it is clipped by the control’s borders.

    • Stretch – The object’s image is resized to fit into and fill the OLE control (default).