The main goal of this example is to show how to use the InterWidgetCommunication method setValue(). This example uses a list (List1) and a function button (Btn1). List1 contains the names of different html pages, and Btn1 launches to the page selected in the list box. Since file names are not valid intinsic values for list entries, we improvise by using an 8-bit intrinsic value for the list entries and then use a combination of Amulet Internal RAM and META REFRESH tags to launch to the selected page. Here is a snapshot of what the html page looks like in a "WYSIWYG" tool:

Figure 1.
When an html name is selected from List1, the intrinsic value of that selection is sent to InternalRAM.byte(0), (which is the Amulet Internal RAM, byte variable 0) using the setValue() method. When Btn1 is hit, it sends out three forceUpdate() methods to three META REFRESH's. These three META REFRESH's (one for each html page in List1) check the value of InternalRAM.byte(0). When the value of InternalRAM.byte(0) equals the trigger value of one of the META REFRESH's, their URL function(s) is called. In this case, their URL launches to a specific page.
List1 holds the names of the pages to launch and invokes the setValue() method of InternalRAM.byte(0) when "hit", with the intrinsic value of the list item selected as the argument. To create List1, use the following :
<APPLET CODE="List.class" WIDTH="58" HEIGHT="57" NAME="List1">
<PARAM NAME="href" VALUE="Amulet:InternalRAM.byte(0).setValue()">
<PARAM NAME="fontSize" VALUE="2">
<PARAM NAME="fontStyle" VALUE="PLAIN">
<PARAM NAME="options" VALUE="page 1=0x01,page 2,page 3">
<PARAM NAME="initialCondition" VALUE="page 1">
< /APPLET>
Notice that the intrinsic value of page 1 is 0x01. Since an intrinsic value is not explicitely given to page 2, the intrinsic value of page 2 is the intrinsic value of the previous entry incremented by 1, or 0x02 in this case. Likewise for page 3, so its intrinsic value is 0x03.
To create Btn1, use the following:
<APPLET CODE="FunctionButton.class" WIDTH="150" HEIGHT="25" NAME="Btn1">
<PARAM NAME="href" VALUE="Amulet:document.Meta1.forceUpdate(),
Amulet:document.Meta2.forceUpdate(),
Amulet:document.Meta3.forceUpdate()">
<PARAM NAME="fontSize" VALUE="2">
<PARAM NAME="fontStyle" VALUE="plain">
<PARAM NAME="label" VALUE="go to selected page">
<PARAM NAME="onButtonPress" VALUE="invert">
< /APPLET>
When Btn1 is hit, it sends out a forceUpdate() method to the three META REFRESH tags. This causes the META REFRESH tags to perform their ONVAR function.
A group of META REFRESH objects monitor the InternalRAM.byte(0) value and launch to the appropriate page when the value equals the trigger value specified by TRIGGER=. These three META REFRESH tags do not update on their own accord. They will only check the value of InternalRAM.byte(0) when Btn1 instructs them to do so. To create the three META REFRESH tags, use the following:
<META HTTP-EQUIV="REFRESH" CONTENT="0;HREF=Amulet:InternalRAM.byte(0).value();URL=page1.html;TRIGGER=0x01;NAME=Meta1"><META HTTP-EQUIV="REFRESH" CONTENT="0;HREF=Amulet:InternalRAM.byte(0).value();URL=page2.html;TRIGGER=0x02;NAME=Meta2">
<META HTTP-EQUIV="REFRESH" CONTENT="0;HREF=Amulet:InternalRAM.byte(0).value();URL=page3.html;TRIGGER=0x03;NAME=Meta3">
Note that the updateRate time for all three META REFRESH tags is set to 0, meaning they will never launch their ONVAR functions unless they are sent the IWC method forceUpdate(). If the intrinsic value of InternalRAM.byte(0) is 0x00, then nothing happens. If it equals 0x01, then Meta1 will launch its function, which is to link to page1.html. If the intrinsic value equals 0x02, then Meta2 will link to page2.html. And finally if the intrinsic value equals 0x03, then Meta3 will link to page3.html.
NOTES: