Using Spytracking             

If you prefer to learn by example, click here to open a Spytracking example of TreeView Professional in a new 'satellite' window. As you move around this documentation, you'll see the menu's selector update to track the currently-open page.

  • Decide which of your pages should include a Spy applet. If each of the links on your menu only opens one page, you should put a Spy on each of those pages. If you use multiple URLs for some (or all) entries, you'll probably include a Spy only in the most important page of the two, three or four that an entry links to. More on that below.

  • In your HTML editor, open the page that the first entry on the menu refers to. Add the following code to it, preferably immediately after the <BODY> tag so that the Spy activates as soon as possible:

    <APPLET CODE="rySpy.class" ARCHIVE="TreeViewPro.jar" CODEBASE="../classes" WIDTH=1 HEIGHT=1>
    <param name=CabBase value="TreeViewPro.cab">
    <param name=BgColor value="FF0000">
    <param name=Name value="Applet01">
    <param name=Item value="1">
    </APPLET>

  • The four pieces of text in bold type may need to be edited, as explained below.

  • Repeat steps 2 and 3 for each page that should include a Spy.


CODEBASE=" "
This attribute gives the location of the "rySpy.class" file, relative to the location of the current page. (The rySpy.class file is included in TreeViewPro.jar, along with the other class files that make up TreeView Professional. Make sure you include the attribute ARCHIVE="TreeViewPro.jar" in each Spy's <APPLET> tag.)

Users often find the CODEBASE= attribute complicated. The trick is to pretend you're linking to an ordinary file in an <A HREF=" "> tag. First, work out the complete relative path to TreeViewPro.jar.  Finally, remove the words 'TreeViewPro.jar' from the end of that path and insert what's left into the CODEBASE= attribute.

If this page is in the same directory as the .jar file, you'll have nothing left after removing the words 'TreeViewPro.jar'! You can either remove the whole CODEBASE="" attribute, or set it to CODEBASE="./".

Note that if this attribute is wrong, the Spy applet will not be found and the Spy will not run. If you're not sure whether you've got it right or not, increase the Spy's dimensions to about 10×10 and look to see if that 10 pixel square is colored in your chosen BgColor (see below). If it's just a dull gray, the applet isn't running.

BgColor
This optional parameter sets the color of the Spy. Being only one pixel square, it's almost invisible anyway, but you can hide that one pixel by using this parameter to match its color to that of your page. The default color is FFFFFF (white).

Name
Because the entire Spytracking system works by a Spy talking to TreeView Professional - and you may have several TreeView Pros or several Spytracking-capable applets running at once - it's important to make sure that the correct applet receives the information intended for it. To make this possible, both TreeView Pro and the Spy must have matching Name parameters. When they report back, the Spy applets first look for an applet whose Name parameter matches their own. It doesn't matter what those names are, and they're not case sensitive.

The existence of the Name parameter in both the Spy and the main menu applet means that you can have two Spytracking applets running at once on the same site and use Spies to control both at once (you can even include two or more Spies on a single page to update two or more menus when that page opens). It also means that if you decide to replace one Spytracking menu with another you won't have to edit the Spy applets on your pages: just give the replacement menu the same Name parameter and make sure its entries are listed in the same order as they were for its predecessor.

NOTE: If the menu does not have a Name parameter, it won't receive any Spy reports.

Item
This is the vital parameter that keeps the menu synchronized. If this Spy should highlight Entry 1 on the menu, the Item parameter should be set to 1. If the Spy should highlight Entry 5, set Item to 5, and so on.

Spytracking & Multiple URLs
There's certainly no need to include a Spy in incidental pages that open in small frames, but you can if you wish. It doesn't matter if several pages all point back to the entry on the menu in their Item parameter. The way to consider it is: if someone uses the Back button on their browser and an incidental page opens in a small frame somewhere, do you want that change reflected on the menu, or should the menu continue to reflect what's shown in a larger and more meaningful frame? Usually you'll just include a Spy in pages opening into that larger frame.

Troubleshooting

  • If you click an entry on the menu and find that a different entry highlights when the page opens, check the Spy code in that page: its Item parameter is set to the wrong entry number!

  • During site testing involving window or frame refreshes, Spytracking may stop responding. Spytracking uses a system of 'handshaking' between three separate applets, and this contact can be broken by window refreshes. To regain Spytracking, either close and reopen the browser window, or use a 'power refresh' (Ctrl+Refresh in Internet Explorer, or Shift+Reload in Netscape).










s

















.