OLE Container Support

Zim supports the creation and manipulation of ActiveX objects and containers. An OLE or ActiveX container is used to embed the COM object into an application. Examples of a container are Visual Basic and Microsoft Word, in addition to Zim itself.

OLE Container Datatype

The OLE or ActiveX Container is a formfield where ft ("fieldtype") is set to "E".

An OLE Container can either be borderless or have an OLE Object border. The OLE Object border is a dashed line for embedded objects and a solid line for linked objects. A selection border surrounds OLE Containers when they have focus. They respond to mouse clicks and transmit keys as image widgets do.

OLE Containers can be assigned OLE object filenames or unique class identifiers. These names or identifiers can be placed in the default value of the created object or can be assigned at runtime. Zim checks the file or class identifier for the OLE Container for Zim's path characters then checks if it is a valid class. If it is not, then Zim assumes it is a filename.

Painter Support for OLE Containers

The Zim Screen Painter provides an OLE Container widget on its menu and gallery. The support in Screen Painter for the OLE Container widget is almost identical to its support for image widgets. The developer does not need to specify an OLE source filename for the OLE Container widget since the OLE container can be empty. If an OLE source filename has been associated with the OLE Container but the file does not exist, the contents of the OLE container widget appear as the OLE source filename centered within hatches; otherwise the OLE object is displayed within the OLE Container.

Support for Linked Objects and Limited Support for Embedded Objects

The Screen Painter creates linked OLE Containers by setting the WdgSubClass of the formfield to 1 when it is first added. Embedded objects have WdgSubClass set to 0. Zim does not support visual editing (also known as in-place activation) of embedded objects and does not store embedded objects as blobs in its data files. The support for embedded objects is limited to enabling assignment, cut, and paste of embedded objects. Linked OLE Containers are stored in Zim's data files as monikers: filenames with extra information. A moniker of the linked formfield is kept up to date, in case a new object was pasted into the container. OLE Container Widgets that contain embedded objects return $null when they are queried. Activation of OLE Containers occurs in the server application.

FORM SET Command

The OLE objects in the OLE Containers can be manipulated programmatically using the following command:

FORM SET (VERB verbName) |fieldname |
                         |formname |
                         |(formnum, fieldnum, subscript)|

where verbName is a string or an expression that evaluates to a string

 fieldname is the name of an OLE Container formfield on the form

formname is the name of a form 

formnum is the number of the form

fieldnum is the number of a field

subscript is the subscript of a formfield

The following verbNames are supported and available as constants:

Positive numbers are specific to the object.

You can use the registry information of an OLE object to determine its primary and other supported verbs. This information can also be obtained using the Zim $GetProperty command.

Cut, Copy and Paste, Paste Link, and Paste Special Menu Items

The cut, copy, paste, Paste Link, and Paste Special menu items are grayed appropriately when the OLE Container formfield has the focus. Linked items can paste only links; embedded objects can paste both embedded objects and links. Paste Link and Paste Special are available only for OLE Container formfields.

$GetProperty ('OleVerbList', FileOrClassName)

The $GetProperty command returns the list of supported verbnames of a file or OLE class. Semicolons separate the verbs in the returned list.

Default Double-click Action on OLE Container Widgets.

Unguarded OLE containers invoke the OLE objects primary verb when double-clicked if DoubleClick has not been identified as a transmit event.

Default Right-click Action on OLE Container Widgets.

Unguarded OLE containers display their available OLE verbs in a right-click menu when they are right-clicked if RightClick has not been identified as a transmit event. If an action is chosen from the right-click menu, it is performed.