helpstuff.com

Helping end-users since 1981

Using secondary windows in HTML Help and WinHelp

While creating secondary windows isn't as easy as point-and-click, creating secondary windows for HTML Help and WebHelp projects is possible.

Before you start, you have to decide where you want to use secondary windows:

  • In an HTML Help (.chm) file
  • In a RoboHTML Project that will get converted to WebHelp

In this section...

Using JavaScript to add a copyright to HTML pages

Creating a link from a secondary window to the main window in HTML Help

Do you suffer from Compulsive Obsessive Pagination Syndrome (C0PS)?

Using the Mark of the Web (MOTW)

Think WYSIOP, not WYSIWYG

Secondary windows in HTML Help

To use secondary windows in a .chm file:

  1. Insert a Related Topics control in the topic. Only add one topic to the Related Topics list. Be sure to specify the secondary window name that you want to use in the appropriate dialog box. Note that the window must already exist.
  2. Go to the TrueCode Editor and look for the Related Topics code. You should see something like what displays below. This example uses a secondary window called second and links to a topic called Colors.htm.

    <OBJECT
    CLASSID="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"
    ID="RelatedTopics"
    ALIGN=BOTTOM BORDER="0"
    VSPACE="0"
    HSPACE="0">
    <PARAM NAME="Command" VALUE="Related Topics">
    <PARAM NAME="Window" VALUE="second">
    <PARAM NAME="Button" VALUE="Text:Related Topics">
    <PARAM NAME="Font" VALUE="MS Sans Serif,8,0,,">
    <PARAM NAME="Item1" VALUE="Colors;Colors.htm"></OBJECT>

  3. The last Name line is the one you need to change. Before the filename, insert the name of the .chm file in the format filename.chm::/. So the new code (assuming that the .chm file is called "paint.chm") would look like this:

    <OBJECT
    CLASSID="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"
    ID="RelatedTopics"
    ALIGN=BOTTOM
    BORDER="0"
    VSPACE="0"
    HSPACE="0">
    <PARAM NAME="Command" VALUE="Related Topics">
    <PARAM NAME="Window" VALUE="second">
    <PARAM NAME="Button" VALUE="Text:Related Topics">
    <PARAM NAME="Font" VALUE="MS Sans Serif,8,0,,">
    <PARAM NAME="Item1" VALUE="Colors;paint.chm::/Colors.htm"></OBJECT>

  4. Use the View option to test this...click View and then click the Related Topics button. It should display the specified topic in the specified window.

Secondary windows in RoboHelp's WebHelp

The goal is to create the necessary code in RoboHTML so that you don't have to edit the results once you've generated WebHelp. There are two ways to use secondary windows in WebHelp.

If you don't care what the size of the window is, enter a window name in the Frame field of the Insert Link dialog box. (As long as you use something other than the default frame locations, you're all set. I tested this with second.)

The other method requires a script. If you plan on using it more than once, an external script file is the easiest.

The command looks like this when all options are set:

function secWindow() { second=window.open(" ", "secondary",_

"height=400,width=400,screenX=50,left=50,screenY=50,_

top=50,location,menubar,resizable,scrollbars,_

status,toolbar");}

where:

  • secWindow is the name of the function (used later)
  • second is the window definition
  • secondary is the name of the new window
  • height, width, and scrollbars are the implemented window features. Once one feature is specified, you have to specify all features that you want enabled. The features you can request are:
    • height is the outer height of window in pixels
    • width is the outer width of window in pixels
    • screenX is the number of pixels from the left of the screen where the new window should be placed (Netscape only)
    • screenY is the number of pixels from the top of the screen where the new window should be placed (Netscape only)
    • left is the number of pixels from the left of the screen where the new window should be placed (Internet Explorer only)
    • top is the number of pixels from the top of the screen where the new window should be placed (Internet Explorer only)
    • location displays the current URL at the top of the window (usually disabled when creating secondary windows)
    • menubar displays the menu bar at the top (usually disabled when creating secondary windows)
    • resizable allows the window to be resized
    • scrollbars means to turn them on if necessary
    • status displays the status bar at the bottom of the window (usually disabled when creating secondary windows)
    • toolbar displays the button bar at the top (usually disabled when creating secondary windows)

For example, to create a secondary window sized at 640x700, use the following command:

second=window.open(" ", "secondary", "height=640,width=700");

Then, you need to modify your hyperlink to use the secondary window:

<a href="URL" target="secondary" onclick=secWindow()>text</a>

Notes:

  • You can specify the URL in the function. By leaving it blank, one function can be used multiple times for different URLs (the URL is specified in the hyperlink).
  • You may have to adjust the height and width values to produce the desired window size.