


This article should give you a quick overview of how to use TX Text Control ActiveX in a Visual FoxPro 9 application. The database development environment Microsoft Visual FoxPro (VFP) is the successor to the xBase-clones (FoxBase). It allows developers to create and query tables in a relational database with an object-oriented programming language (based on dbase).
Additionally, it allows the usage of ActiveX controls on its forms. This article shows you how to create an instance of 4 TX Text Controls and how to connect them. Additionally, it shows how to call simple methods and properties.
First, create a project by choosing New... from the File menu. In the next opened file dialog, type in a name for your new project and confirm with Save.
A blank project has been just been created by Visual FoxPro. In the project manager dialog, choose Forms from the Documents tree node and click on New... to create a new form. In the next dialog, click New Form. The Form Designer is display with a blank form.

To add TX Text Control ActiveX to the selected ActiveX controls, please click Options... from the Tools menu in the menu bar. Click on the Controls tab in the opened dialog. Choose ActiveX Controls and browse for the 4 TX Text Control components. Check all 4 controls and confirm with OK.

If you click View Classes button and choose ActiveX Controls, you will now find TX Text Control ActiveX in the Form Controls dialog.
Toggle the TX Text Control button in the Form Controls dialog and draw TX Text Control on the form. Repeat this with the 3 other controls that belongs to TX Text Control ActiveX. In the Properties window, change the name property of each control to an appropriate name. In our sample, we choose TX1 for TX Text Control, BB1 for the button bar, RB1 for the ruler bar and SB1 for the status bar. To align the controls on the form, you have to set the Align property of the controls to top respectively bottom. Your form should look like this:

To connect the 4 controls, select the form, double-click the Init event in the Properties window on the Method tab page. The code window for this event is shown. Type in the following code to connect the controls:
this.TX1.ButtonBarHandle = this.BB1.hwnd
this.TX1.RulerHandle = this.RB1.hwnd
this.TX1.StatusBarHandle = this.SB1.hwndIn the downloadable sample, we have created an additonal button to insert a table into the TX Text Control. Notice that the form must be specified before accessing the TX Text Control's properties and methods:
thisform.TX1.TableInsert(3,3,-1,13)At least a TX Text Control ActiveX 11.0 Trial version and Visual FoxPro 9 is required to load the sample.