Displays an OLE document that is stored in an OLE field, and lets the user initiate an action in the server application that created the document.

Syntax

[<oRef> =] new OLE(<container> [,<name expC>])

<oRef>

A variable or property—typically of <container>—in which to store a reference to the newly created OLE object.

<container>

The container—typically a Form object—to which you’re binding the OLE object.

<name expC>

An optional name for the OLE object. If not specified, the OLE class will auto-generate a name for the object.

Properties

The following tables list the properties, events, and methods of interest in the OLE class.

Property

Default

Description

alignment

Stretch

Determines the size and position of the contents of the OLE object (0=Stretch, 1=Top left, 2=Centered, 3=Keep aspect stretch, 4=True size)

anchor

0 – None

How the OLE object is anchored in its container (0=None, 1=Bottom, 2=Top, 3=Left, 4=Right, 5=Center, 6=Container)

baseClassName

OLE

Identifies the object as an instance of the OLE class

border

false

Whether the OLE object is surrounded by the border specified by borderStyle

className

(OLE)

Identifies the object as an instance of a custom class. When no custom class exists, defaults to baseClassName

dataLink

 

The Field object that is linked to the OLE object

linkFileName

 

The OLE document file (if any) that is linked with the current OLE field.

oleType

 

Number that reflects whether an OLE field is empty (0), contains an embedded document (1), or contains a link to a document file (2)

serverName

 

The server application that is invoked when the user double-clicks on an OLE viewer object

 

Event

Parameters

Description

onChange

 

After the contents of the OLE object have changed

onClose

 

After the form containing the OLE object has been closed

 

Method

Parameters

Description

doVerb( )

<OLE verb expN>,
<title expC>

 

Starts an OLE server session

The following table lists the common properties, events, and methods of the OLE class:

Property

 

Event

Method

before
borderStyle

dragEffect

enabled

form

height

hWnd

id

left

mousePointer

name
pageno

parent

printable

speedTip

statusMessage

systemTheme
tabStop

top

visible

width

onDesignOpen
onDragBegin

onGotFocus

onLostFocus

onOpen

drag( )
release( )

setFocus( )

Description

Place an OLE object in a form to view and edit a document stored in an OLE field. For example, if an OLE field contains a bitmap image created in Paintbrush, double-clicking the OLE object linked to the field starts a session in Paintbrush and places the image in the Paintbrush work area.

OLE stands for object linking and embedding. When you link a document to an OLE object, the OLE field does not contain the document itself; instead, it holds a link to a file containing the document. When you embed a document in an OLE field, a copy of the document is inserted into the OLE field, and no connection is made to a document file.

By double-clicking the OLE object, the user can invoke the application that created the OLE document. Therefore, if an image was created in Paintbrush and linked or embedded in the OLE field, double-clicking on the field starts a session in Paintbrush; the image is displayed in the Paintbrush drawing area, ready for editing. If the object was linked, any changes made in the Paintbrush session are stored in the document file; if the object was embedded, the changes are stored in the OLE field only.

An OLE viewer window object displays the contents of an OLE field. (Use the dataLink property to identify the field.) Each time the record pointer is moved, the contents of the viewer window are refreshed to display the OLE field in the current record.