OLECustomControl control (OCX)

The PowerBuilder class OLECustomControl is a container for OLE custom controls, also known as ActiveX controls or OCXs. When you create a PowerBuilder OLE custom control container, the Insert Object dialog prompts you to select the control to insert in the container. Your choices are the controls that have been registered in the system registry. If a control is not registered by its install process, you can register it in the Insert Object dialog box.

The Browser also displays registered controls. Select the OLE tab of the Browser and double-click OLE Custom Controls.

Properties

In OLE terminology, font information and the display name are called ambient properties. Ambient properties provide default information that the custom control can use, if it is programmed to recognize and use such information.

PowerBuilder does not display text for the control, so it does not use the font and display name properties directly. If the control is programmed to recognize ambient properties, it can use the values PowerBuilder provides when the control displays text or needs a name to display in a title bar.

OLECustomControl property

Datatype

Description

AccessibleDescription

String

A description of the control and/or its purpose for use by accessibility tools such as readers for visually impaired users.

AccessibleName

String

A label that briefly describes the control, such as the text in a button or the name of a menu item.

AccessibleRole

AccessibleRole (enumerated)

Describes what kind of user interface element the control is.

Alignment

Alignment (enumerated)

Specifies the text alignment in the control. Values are:

Center!

Justify!

Left!

Right!

BackColor

Long

Specifies the numeric value of the background color: -2 to 16,777,215. For more information about color, see the section called “RGB” in PowerScript Reference.

BinaryIndex

Integer

Internal use only.

BinaryKey

String

Internal use only.

Border

Boolean

Specifies whether the control has a border. Values are:

TRUE -- Control has a border.

FALSE -- Control does not have a border.

BorderStyle

BorderStyle (enumerated)

Specifies the style of the border of the control. Values are:

StyleBox!

StyleLowered!

StyleRaised!

StyleShadowBox!

BringToTop

Boolean

Specifies whether PowerBuilder moves the control to the top of the front-to-back order (set at runtime only). Values are:

TRUE -- Control moved to top.

FALSE -- Control not moved to top.

Cancel

Boolean

Specifies whether the control acts as the Cancel button in the window (the Cancel button receives a Clicked event if the user presses Esc). Values are:

TRUE -- Control is the Cancel button.

FALSE -- Control is not the Cancel button.

ClassDefinition

PowerObject

An object of type PowerObject containing information about the class definition of the object or control.

ClassLongName

String

Specifies the long name for the server application associated with the OLE object in the control (read-only).

ClassShortName

String

Specifies the short name for the server application associated with the OLE object in the control (read-only).

DisplayName

String

Specifies a user-readable name for your OLE control. This name is displayed in OLE dialog boxes and windows that show the object's name. If you do not specify a value, the name of the control (such as ole_1) is used for DisplayName.

Default

Boolean

Specifies whether the button-style OLE control is the default control in the window (the default control has a thick border and receives a Clicked event if the user presses  Enter without selecting a control).

This property applies only to controls that act like command buttons.

Values are:

TRUE -- Control is the default control.

FALSE -- Control is not the default control.

Editable controls

Default behavior can be affected by editable controls on the window. For more information, see the Users Guide.

DragAuto

Boolean

Specifies whether PowerBuilder puts the control automatically into Drag mode. Values are:

TRUE -- When the control is clicked, the control is automatically in Drag mode.

FALSE -- When the control is clicked, the control is not automatically in Drag mode. You have to manually put the control into Drag mode by using the Drag function.

DragIcon

String

Specifies the name of the stock icon or the file containing the icon you want to display when the user drags the control (the ICO file). The default icon is a box the size of the control.

When the user drags the control, the icon displays when the control is over an area in which the control can be dropped (a valid drop area). When the control is over an area that is not a valid drop area, the No-Drop icon displays.

Enabled

Boolean

Specifies whether the control is enabled (can be selected). Values are:

TRUE -- Control can be selected.

FALSE -- Control cannot be selected.

FaceName

String

Specifies a typeface name (for example, arial or courier) that you want the control to use for text (when the control is designed to use this ambient property).

FocusRectangle

Boolean

Specifies whether a dotted rectangle (the focus rectangle) frames the control when it has focus. Values are:

TRUE -- Control framed when it has focus.

FALSE -- Control not framed when it has focus.

FontCharSet

FontCharSet (enumerated)

Specifies the font character set that you want the control to use for text (when the control is designed to use this ambient property). For a complete list of possible values, see the list of properties for the FontCharSet variable on the Enumerated tab page of the Browser.

FontFamily

FontFamily (enumerated)

Specifies the font family (type style) that you want the control to use for text (when the control is designed to use this ambient property). Values are:

AnyFont!

Decorative!

Modern!

Roman!

Script!

Swiss!

FontPitch

FontPitch (enumerated)

Specifies the pitch (character spacing) that you want the control to use for text (when the control is designed to use this ambient property). Values are:

Default!

Fixed!

Variable!

Height

Integer

Specifies the height of the control, in PowerBuilder units.

IsDragTarget

Boolean

Specifies whether data can be dropped on the control. Values are:

TRUE -- Data can be dropped on control.

FALSE -- Data cannot be dropped on control.

Italic

Boolean

Specifies that you want the control to display text in italic (when the control is designed to use this ambient property). Values are:

TRUE -- Text is italic.

FALSE -- Text is not italic.

Object

omObject

Specifies the link information that connects the control to the server's data.

Pointer

String

Specifies the name of the stock pointer or the file containing the pointer used for the control.

TabOrder

Integer

Specifies tab value of the control within the window (0 means the user cannot tab to the control).

Tag

String

Specifies the tag value assigned to the control.

TextColor

Long

Specifies the color that you want the control to use for text (when the control is designed to use this ambient property). The color is a numeric value: -2 to 16,777,215. For more information about color, see the section called “RGB” in PowerScript Reference.

TextSize

Integer

Specifies the point size that you want the control to use for displaying text (when the control is designed to use this ambient property). For backward compatibility, the size is stored as a negative number; for example, 10-point text size is stored as -10.

Underline

Boolean

Specifies that you want the control to underline text (when the control is designed to use this ambient property). Values are:

TRUE -- Text is underlined.

FALSE -- Text is not underlined.

Visible

Boolean

Specifies whether the control is visible. Values are:

TRUE -- Control is visible.

FALSE -- Control is not visible.

Weight

Integer

Specifies the stroke weight that you want the control to use for text (when the control is designed to use this ambient property). Sample values are 400 for normal or 700 for bold.

Width

Integer

Specifies the width of the control, in PowerBuilder units.

X

Integer

Specifies the X position (the distance from the left edge of the window), in PowerBuilder units.

Y

Integer

Specifies the Y position (the distance from the top of the window), in PowerBuilder units.


Events

The PowerBuilder Script painter displays PowerBuilder events and events defined by the control inserted in the control.

To get information about an event that does not appear in this list, check the documentation for the control.

OLECustomControl event

Occurs

Clicked

When the control is clicked (selected or unselected).

Constructor

Immediately before the Open event occurs in the window.

DataChange

When the server application notifies the control that data has changed.

Destructor

Immediately after the Close event occurs in the window.

DoubleClicked

When the control is double-clicked (and possibly activated).

DragDrop

When a dragged control is dropped on the control.

DragEnter

When a dragged control enters the control.

DragLeave

When a dragged control leaves the control.

DragWithin

When a dragged control is within the control.

Error

During OLE automation when an error occurs.

ExternalException

During OLE automation when the OLE server generates an exception during command execution (getting and setting properties, calling functions).

GetFocus

Just before the control receives focus (and possibly becomes activated).

Help

When the user presses the F1 key or drags the context help button (question mark) from the title bar to a menu item or control.

LoseFocus

When the control loses focus (becomes inactive).

Other

When an operating environment message occurs that is not a PowerBuilder event.

PropertyChanged

When an OLE Server supporting notifications sends a message that a property value has been changed.

PropertyRequestEdit

When an OLE Server supporting notifications sends a message that a property value is about to be changed.

RButtonDown

When the right mouse button is pressed in the control.


Functions

OLECustomControl function

Datatype returned

Description

ClassName

String

Returns the name assigned to the control

Drag

Integer

Puts the object into drag mode

GetContextService

Integer

Creates a reference to a context-specific instance of the specified service

GetData

Integer

Returns data in a format you specify from an OLE server that supports Uniform Data Transfer

GetNativePointer

Integer

Returns a pointer to the underlying OLE object

GetParent

PowerObject

Returns a reference to the name of the parent object

Hide

Integer

Makes the control invisible

Move

Integer

Moves the control to a specified location

PointerX

Integer

Returns the distance of the pointer from the left edge of the control

PointerY

Integer

Returns the distance of the pointer from the top of the control

PostEvent

Boolean

Adds an event to the end of the message queue for the control

Print

Integer

Prints the control

ReleaseNativePointer

Integer

Releases pointer to underlying OLE object

Resize

Integer

Changes the size of the control

SetData

Integer

Sends data in a caller-supplied format to an OLE server that supports Uniform Data Transfer

SetFocus

Integer

Sets focus to the control

SetPosition

Integer

Specifies the position of the control in the front-to-back order of the window

SetRedraw

Integer

Controls automatic redrawing of the control after each change in its properties

Show

Integer

Makes the control visible

TriggerEvent

Integer

Triggers a specific event for the control and executes the script for the event

TypeOf

Object

Returns the type of the control