

This basic sample should give you an impression of how to use TX Text Control ActiveX easily within a PowerBuilder application. These samples show you how to include TX Text Control ActiveX into PowerBuilder and is not intended to show you the sophisticated word processing features such as those in the shipped Visual Basic or Delphi sample applications.
After starting PowerBuilder, we have to create a new workspace. Click on New... in the File menu. In the dialog, please choose Workspace from the Workspace tab page and click OK.
In the following dialog, please type in a name for the workspace and confirm with Save.

After that, we have to create a new applicaton. Choose again New... from the File menu. Select Template Application on the Target tab page to start the application wizard. This will assist you creating a fully functional application.

In the wizard, confirm the first 3 pages with Next. On the forth page (Specify Template Type), select SDI Application and confirm with Next.

Confirm the next 3 pages with Next until you get the Specify Connectivity page. As we would like to show just the basics, we choose None and confirm this page with Next. On the next page (Create Project?), select Yes, create project now and click on Next. Confirm the next 3 pages with Next. If the page Generate Machine Code is displayed, select Yes, generate machine code EXE and DLLs. and confirm with Next. The next 3 pages can be confirmed with Next respectively Finish.
After these steps, PowerBuilder creates a complete project with a main form and an About dialog box. Double click on the w_genapp_main form to open the Layout window for this form. If the Layout tab is not automatically selected, please do this by clicking on the corresponding tab.

Select Control -> OLE... from the Insert menu. PowerBuilder displays the Insert Object dialog box. There are three tabs to choose from. Click the Insert Control tab, browse for the TX Text Control ActiveX, select it and click on OK.

Now, you can place this control on your form.
Repeat this step with the 3 other controls of TX Text Control: the ruler bar, the button bar and the status bar. Your form should look this this:

Click on the TX Text Control object on the form to select it. In the Properties window, change the Name of the control from ole_1 to an adequate name like TX1. Repeat this with the other controls. In our sample, we changed the name to: TX1, TXBB1, TXRB1 and TXSB1.
Now, we have to connect the 4 controls. This is done during the initialization of the application. Click on the open tab to show the code for the open event. To access the properties and methods of TX Text Control ActiveX, the Object class must be used. Use the following code to connect the 4 controls.
TX1.Object.ButtonBarHandle = TXBB1.Object.hWnd
TX1.Object.RulerHandle = TXRB1.Object.hWnd
TX1.Object.StatusBarHandle = TXSB1.Object.hWndTo run the application, press CTRL+R. In the sample, we created an additional button to show how to insert a table into the document. The following code inserts a table at the current input position with text in the first cell.
TX1.Object.TableInsert(3, 3, -1, 13)
TX1.Object.TableCellText(13, 1, 1, "Table cell text")At least a trial version of TX Text Control ActiveX 11.0 and PowerBuilder 10 is required to run this sample.