OLE controls in a window – PB Docs 125

OLE controls in a window

You can add OLE objects and ActiveX controls to a window or
user object. To do so, you use one of the PowerBuilder OLE controls,
which acts as an OLE container. This section explains how you select
the control you want by choosing whether it holds an OLE object
(also called an insertable object) or an ActiveX control:

  • An insertable
    OLE object
    is a document associated with a server application.
    The object can be activated and the server provides commands and
    toolbars for modifying the object.

  • An ActiveX control or OLE
    custom control
    is itself a server that processes user
    actions according to scripts you program in PowerBuilder. You can
    write scripts for ActiveX control events and for events of the PowerBuilder
    container. Those scripts call functions and set properties that
    belong to the ActiveX control. When appropriate, the ActiveX control can
    present its own visual interface for user interaction.

ActiveX controls range from simple visual displays (such as
a meter or a gauge) to single activities that are customizable (spellchecking
words or phrases) to working environments (image acquisition with
annotation and editing).

OLE control container features

All OLE control containers support a set of required interfaces.
PowerBuilder provides some additional support:

  • Extended control

    An OLE control can determine and modify its location at runtime
    using its extended control properties. PowerBuilder supports the
    X (Left), Y (Top), Width, and Height properties, all of which are
    measured in PowerBuilder units. The control writer can access these properties
    using the IDispatch-based interface returned from the GetExtendedControl method
    on the IOleControlSite interface.

  • Window as OLE container

    PowerBuilder implements the IOleContainer class at the window
    level, so that all OLE controls on a window are siblings and can
    obtain information about each other. The control writer can access
    this information using the OLE EnumObjects method.
    Information about siblings is useful when the controls are part
    of a suite of controls. Unlike other controls, the OLE controls
    on a window are stored in a flat hierarchy.

    note.png OLE objects and controls only

    Only OLE objects and controls are visible to this object enumerator.
    You cannot use this technique to manipulate other controls on the
    window.

  • Message reflection

    If a control container does not support message reflection,
    a reflector window is created when an OLE control sends a message
    to its parent. The reflector window reflects the message back to the
    control so that the control can process the message itself. If the container
    supports message reflection, the need for a reflector window, and
    the associated runtime overhead, is eliminated. PowerBuilder OLE control
    containers perform message reflection for a specific set of messages.

Defining the control

This procedure describes how to create an OLE control and
select its contents.

proc.png To place an OLE control in a window or user object:

  1. Open the window or user object that will
    contain the OLE control.

  2. Select Insert>Control>OLE from
    the menu bar.

    PowerBuilder displays the Insert Object dialog box. There
    are three tabs to choose from.

  3. Choose a server application or a specific object
    for the control (which embeds or links an object in the control),
    select a custom control, or leave the control empty for now:

    • To create
      and embed a new object
      , click the Create New tab. After
      you have chosen a server application, click OK.

    • To choose an existing object for the control,
      click the Create From File tab. After you have specified the file,
      click OK.

    • To insert a custom control (ActiveX
      control), click the Insert Control tab. After you have chosen an
      ActiveX control, click OK.

    • To leave the control empty,
      click Cancel.

      If you click Cancel, the control becomes an OLE control rather
      than an OLE custom control, and you can choose to link or embed
      an OLE object in it at any time; you cannot insert an ActiveX control
      later.

  4. Click where you want the control.

    If you inserted an object, PowerBuilder opens the server application
    so you can view and edit the object. ActiveX controls cannot be
    opened.

If you want to insert an object that belongs
to an OLE server application that is not in the list, see the server
documentation to find out how to install it.

For more information about using the Insert
Object dialog box, see the section on inserting OLE objects in DataWindow
objects in the PowerBuilder Users Guide.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x