ActiveX Control Pad and the HTML Layout Control

The techniques already discussed are useful in obtaining class IDs for ActiveX controls and in inserting the controls into web pages, but you'll find that using the <OBJECT></OBJECT> tags to place ActiveX controls has definite limitations. A big problem for a developer creating an interactive web page is the placement of controls on the page. For example, developers of Visual Basic applications are accustomed to placing controls precisely on forms, but this can be difficult in HTML. Control placement in HTML is merely a suggestion to the browser, and the browser is generally free to reformat the page as necessary. Therefore, developers cannot guarantee the final placement of any ActiveX control by simply using the <OBJECT></OBJECT> tags.

In an attempt to allow developers to specify exact placement of ActiveX controls in a web page, Microsoft has created the HTML Layout control, to be used with ActiveX Control Pad. ActiveX Control Pad and the HTML Layout control are discussed in detail in Chapter 9, but an example of what the HTML Layout control can do is provided here.

In this example, a Hangman game was created with the HTML Layout control. The Hangman game requires the exact placement of image controls to provide the graphics. Figure 4-7 depicts the Hangman layout as shown in the HTML Layout control, and Figure 4-8 shows the Hangman game in the Internet Explorer.

Figure 4-7.

The Hangman layout in the HTML Layout control.

Figure 4-8.

The Hangman game in the Internet Explorer.

Listing 4-2 shows the contents of the Hangman HTML file. If you are interested in the alx layout file for Hangman, you can find it on the companion CD, in the samples folder.


<FORM NAME="frmHangman">

ID="hang" STYLE="LEFT:0;TOP:0">
<PARAM NAME="ALXPATH" REF VALUE="file:hang.alx">


Listing 4-2.

The Hangman HTML file.

© 1996 by Scot Hillier. All rights reserved.