This message contains graphics. If you do not see the graphics: Graphic Version.
 
TX Text Control in MS Internet Explorer

As many users encounter problems when trying to use the TX Text Control in Internet Explorer, we will cover this topic in this weeks TNT.

First of all, you need the main TX object. This is inserted by using the HTML OBJECT:

<OBJECT CLASSID="clsid:3D6D5D2F-B9F2-101C-AED5-00608CF525A5" ID=objTX WIDTH=600 HEIGHT=400> <PARAM NAME="ViewMode" VALUE="2"> <PARAM NAME="ScrollBars" VALUE="3"> <PARAM NAME="PageWidth" VALUE="12240"> <PARAM NAME="PageHeight" VALUE="15840"> </OBJECT>

The CLASSID parameter is very important. There mustn't be a typo in that! Through the ID parameter, you can specify a name with which you reference the TX in VB Script.

Between the two OBJECT tags you place some initial property settings like the page dimensions or the ViewMode to be used.

Now you probably want to add a ButtonBar or a StatusBar. This is a little tricky in IE. There is no event like the Form_Load event in VB. You can't use the event, this is called before the two objects have been created.

But fortunately TX offers a solution. You can use the BODY onLoad event to set the ButtonBarHandle, ... to 1. This tells TX that you want to set these handle when all controls have been created. So, TX fires an event called ConnectTools, when it's ready to receive the handles. The code to do that looks like the following:

<HTML> <HEAD> <TITLE>A Simple First Page</TITLE> <SCRIPT LANGUAGE="VBScript"> <!-- Sub Load() objTX.ButtonBarHandle = 1 End Sub Sub objTX_ConnectTools() objTX.ButtonBarHandle = objBB.hWnd End Sub --> </SCRIPT> </HEAD> <BODY onLoad="Load()">

Where objBB is the ButtonBar object. Here are the class ids for the other TX controls:

ButtonBar: clsid:B6A084E0-BF8F-101C-AED5-00608CF525A5 StatusBar: clsid:B6A084EA-BF8F-101C-AED5-00608CF525A5 Ruler: clsid:B6A084E5-BF8F-101C-AED5-00608CF525A5

Another way to solve the problem is to build a custom OCX control that wraps the TextControl and/or a ButtonBar/StatusBar/Ruler.

I think it's not too hard to create such an OCX with VB. Create a new "ActiveX Control" project and place the controls you want on the form. Now you have to create properties that should be accessible from outside. For instance, you want to make the TextControls .Text property available from outside. Then you have to define your own property like the following:

Public Property Get Text() As String Text = TXTextControl1.Text End Property Public Property Let Text(ByVal t As String) TXTextControl1.Text = t End Property

And, getting back to our intention why we built the custom OCX, you should place the following code in the Initialize event:

Private Sub UserControl_Initialize() TXTextControl1.ButtonBarHandle = TXButtonBar1.hWnd TXTextControl1.StatusBarHandle = TXStatusBar1.hWnd End Sub

It's a little work to built the entire OCX, but when done you have a custom control, that exactly fits your needs.

There are a few points you have to pay attention to, when you want to distribute your OCX along with TX.

All of the controls, also the one you created yourself have to be included in the LPK file. Please read the chapter in the OCX programmer's guide called "Using TX Text Control with HTML and VBScript", if you don't know what an LPK file is.

You should place your OCX in a CAB file. You can either use the same CAB file as the TX's one or generate a new one. This is necessary to register the OCX on the target machine. The CAB file has to be referenced in each OBJECT tag. Further information you can find in the chapter mentioned above in the OCX programmer's guide.<&p>
Best regards

The Newsletter Team

Text Control GmbH respects your online time and privacy. We only send this newsletter to TX Text Control customers and people who have signed up to receive it. However, if you would prefer not to receive future issues of the newsletter, you may unsubscribe at any time. If you received this newsletter forwarded from a colleague or friend, you may wish to subscribe directly.

Sent to: N/A.

Imprint | Unsubscribe | Subscribe

© 2001 Text Control GmbH. All Rights Reserved.