Example 1: looking
at the weather 
In the main window of the applet, click on the open button. The
content of the configuration list is listed in a dialog box for you to choose. Choose the
configuration named "weather". It is a script written in dgsl (see developer
guide). This script needs two variables; level1 and level2. If they are not already
defined, the dgsl interpreter (which is embedded in the SynopticView graphical
component) will automatically create them in the real-time database. You can affect some
value to level1 and level2 either from the Web server or directly from the applet (For
example you could create two TextFields in a CompoundView connected to level1 and
level2. The main window is set to CompoundView by default when you open the applet).
The first interesting line in the script is:
image 54 $(;140-(10*$level1);) frog1.gif
This line draws the image frog1.gif on the ladder. The Y position of
the frog depends of level1 which is expected to vary from 0 to 10.
The second line is:
symbol 4 230 40 $level2 sun.gif suncl.gif clouds.gif rain.gif
This line draws on a fix position one of the listed images. The choice
of the image depends on level2. If level1 is set to 0, then the image sun.gif is
displayed. . If level1 is set to 1, then the image suncl.gif is displayed and so on. If
you want your kid to play with the frog, you can use the configuration created in the
previous chapter and move the frog position with the slider. |