TX Text Control ActiveX

ObjectInsert Method

Method

This method inserts a new OLE object or other control anchored to a paragraph. The inserted object is then moved with the text.

Introduced: 12.0.

Syntax

TXTextControl.ObjectInsert ObjectType, FileName, TextPos, Alignment, PosX, PosY, ScaleX, ScaleY, TextFlow, DistanceL, DistanceT, DistanceR, DistanceB[, KindOfObject]

Parameters

ParameterDescription
ObjectTypeSpecifies the type of object. It can be one of the following identifiers:
FileNameThe meaning of this parameter depends on the object that is to be inserted. See the description of the ObjectType parameter. This parameter can be zero, if the ObjectType parameter specifies a handle to a control.
TextPosSpecifies a text position in the paragraph where the object should be inserted. If TextPos is -1, the object is anchored to the paragraph at the current input position.
AlignmentSpecifies the object's horizontal alignment. It can be one of the following values:
PosXSpecifies the object's horizontal position in twips relative to the left border of the paragraph. This value is used, if the Alignment parameter has been set to 0.
PosYSpecifies the object's vertical position in twips relative to the top border of the paragraph.
ScaleXSpecifies a horizontal scaling factor as a percentage.
ScaleYSpecifies a vertical scaling factor as a percentage.
TextFlowSpecifies how text flows around the image or object. It can be one of the following values:
DistanceL, DistanceT, DistanceR, DistanceBSpecifies distances, in twips, between the image or object and the text.
KindOfObjectOptional. Specifies an identifier for controls that are not OLE objects. If a document is loaded which contains such controls, an ObjectGethWnd event occurs for each control to give an application the opportunity of recreating these controls. This parameter can be used to handle groups of different control types, like buttons or checkboxes.

ObjectType

ValueDescription
1 - OLE objectInserts an OLE object. The type of object can be selected with the system embedded OLE Insert dialog box.
2 - OLE object (programmatic identifier)Creates a newly created OLE object. In this case, the FileName parameter must specify a string which is the programmatic identifier of the OLE object to insert. The programmatic identifier is stored under the ProgID key in the registration database.
3 - OLE object (embedded)Inserts a newly created embedded OLE object from a file. In this case, the FileName parameter must specify a valid filename.
4 - OLE object (linked)Inserts a newly created linked OLE object from a file. In this case, the FileName parameter must specify a valid filename.
OtherwiseSpecifies a handle to a control that can be obtained with a control's hWnd property. In this case the FileName parameter must be set to zero.

Alignment

ValueDescription
0The horizontal position is given through the PosX parameter.
1The object is left aligned relative to the paragraph to which it is anchored.
2The object is right aligned relative to the paragraph to which it is anchored.
3The object is centered relative to the paragraph to which it is anchored.

TextFlow

ValueDescription
2The text stops at the top and continues at the bottom of the object.
3The text flows around the object and empty areas at the left and right side are filled.

Return Value

The method returns the object's identifier when an object could be inserted. Otherwise, it returns zero. The object's identifier can also be obtained with the ObjectCurrent property.

Data Types

NameData type
ObjectTypeHandle
FileNameString
TextPosLong
AlignmentInteger
PosXLong
PosYLong
ScaleXInteger
ScaleYInteger
TextFlowInteger
DistanceLInteger
DistanceTInteger
DistanceRInteger
DistanceBInteger
KindOfObjectInteger
Return valueInteger

See Also