Inserting a Text Frame

Visual Basic User's Guide > Using Text Frames

TX Text Control provides three different methods for inserting text frames:

The first sample program shows how to insert a text frame using TextFrameInsert. The source code for this sample program can be found in the Samples\vb6\TextFrames\Inserting Text Frames folder.

The sample program has two menu items, one of which calls TX Text Control's TextFrameInsert method to create a text frame, and the other one calls ObjectAttrDialog to open a settings dialog box.

[Visual Basic 6]
Private Sub mnuTextFrame_Insert_Click()
    TXTextControl1.TextFrameInsert -1, 0, 0, 0, 1000, 1000, 3, 20, 20, 20, 20
End Sub

Private Sub mnuTextFrame_Settings_Click()
    TXTextControl1.ObjectAttrDialog
End Sub

Text frames can be moved and resized by dragging them with the mouse. Clicking on the border of a text frame selects and activates it. After a text frame has been selected, its Settings dialog box can be opened by clicking the Settings menu item.

TX Text Control's ObjectAttrDialog method can be used on all types of insertable objects, including text frames, images and OLE objects. To prevent the dialog box from being displayed when no text frame has been selected, the corresponding menu item is only enabled after a text frame has been clicked on. This is done in the sample program's mnuTextFrame_Click event handler:

[Visual Basic 6]
Private Sub mnuTextFrame_Click()
    mnuTextFrame_Settings.Enabled = (TXTextControl1.ObjectGetSelected(&H20) <> 0)
End Sub

ObjectGetSelected is another method that can be used with all insertable objects. Its parameter determines which type of object to look for.