|
|
ControlPad Manual
|
1. What is the ControlPad Applet?
|
|
Script and Control Duckware JavaTM
applets without using JavaScript
The ControlPad "cpad.class" Applet is provided as a part of
all Duckware Java applets. It is designed to control and script any Duckware
applet (including itself), but will not control third party (non-Duckware)
applets.
ControlPad is a fully programmable GUI. You design the GUI and you
control what actions take place (via Native Scripting) when a user
activates components in your GUI. Examples
Here is an example of how the ControlPad Applet (below right) can be
used to create a GUI to control the PMVR and FloorPlan applets (below left). The left and
right arrows in the ControlPad control the PMVR scrolling direction.
These are single click areas (no auto repeat). The plus and minus signs
control zoom in and zoom out, both of which auto repeat (they continue
to activate as you continue to hold the mouse down):
| PMVR and FloorPlan Applets |
|
|
|
|
|
The HTML applet code for the ControlPad that accomplishes this
looks like the following:
<applet code="cpad.class" width=88 height=51>
<param name="back" value="images/back.gif">
<param name="over" value="images/over.gif">
<param name="reg0" value="r=14,17,11,17">
<param name="reg1" value="r=64,17,11,17">
<param name="reg2" value="r=38,8,12,12;delay=250;repeat=50">
<param name="reg3" value="r=38,31,12,12;repeat=50">
<param name="cmd0" value="pmvr.auto=-10">
<param name="cmd1" value="pmvr.auto=10">
<param name="cmd2" value="pmvr.key=a">
<param name="cmd3" value="pmvr.key=z">
</applet>
|
The key and power of the ControlPad applet is that you control the
GUI (eg: back.gif and over.gif above)
and what actions take place when the user clicks on a hot spot within
that GUI. In the example above, the back and
over images defined the GUI.
When combined
with Native Scripting, you are able to
program complex actions without having to use JavaScript. This allows
you to create custom 'skins' for the Duckware applets.
|
2. ControlPad Applet Parameters
|
|
The basic set of parameters that can be set in a ControlPad applet
are as follows:
| Basic cpad.class Java Applet Parameters |
| Parameter | Type | Description |
| back | URL |
Background image (default: none)
|
| over | URL |
Mouse over image (default: none)
|
| reg# | region-spec |
Defines a hit region and optional auto repeat rate
|
| cmd# | command-spec |
Command to run when a region is selected
|
The advanced applet parameters are:
| Advanced cpad.class Java Applet Parameters |
| Parameter | Type | Description |
| tile | URL |
Background image, tiled (default: none)
|
| script | file-ref |
Runs the given script
|
| background | hex-color |
Background color of the applet (default gray: C0C0C0)
|
| groups | groups-spec |
Groups regions together for the 'focus' param [1.0b]
|
| focus | focus-spec |
Sets the focus to a region in a group [1.0b]
|
| spot | URL |
Defines a spot image (usually a small GIF) [2.0a]
|
| xy | xy-spec |
Positions the spot image within the cpad GUI [2.0a]
|
| skin | URL |
A 2x2 (corners) Image: creates a 'frame' inside the display [5.2a]
|
The background image is displayed within the applet window. If the user
moves the mouse over a hit region, that hit region area is redrawn using
pixels from the mouse over image. When the user clicks on a hit region,
the action for that region, defined by cmd#, is performed. Please
refer to the example above for a configuration example.
hex-color: A color specified in 'RRGGBB' (red/green/blue) hexadecimal
format. For example, 'FF0000' is pure red, '00FF00' is pure green, '0000FF'
is pure blue, 'FFFFFF' is white, '000000' is black, 'CCCCCC' is light gray,
etc. Please refer to
http://www.utexas.edu/learn/html/colors.html
for a list of sample colors along with 'RRGGBB' values.
region-spec: Defines a clickable rectangular hit region
within the applet, with optional repeat and delay parameters
(in milliseconds). When a user clicks on the region, the
corresponding cmd# command is activated. The syntax
is as follows:
|
r=left,top,width,height{;delay=ms{;repeat=ms}}
|
where 'r' specifies a rectangular hit region. By default, when a region
is clicked on by the user, it will 'fire' just once. However, you can
customize the delay and repeat. See the 'zoom in' and 'zoom out' in the
example above to see this in action.
For example:
|
r=38,8,12,12;delay=250;repeat=50
|
command-spec: The syntax of a command allows for a parameter
within an applet to be set. The syntax is:
which allows you to set an applet parameter to a value. You can control
parameters in other applets by prefixing the parameter name with the
applet name.
For example:
The real power of this becomes evident when you set the script
variable within a Duckware applet to take advantage of the
Native Scripting
support present in all Duckware applets. This then allows
you to reconfigure any number of applet parameters. For example:
For example:
|
pmvr.script=script.txt:gotoGreatRoom
|
groups-spec: Used to combine multiple regions into a group
so that the 'focus' parameter will automatically select an item in a group
and unselect all other items in the group. The syntax looks like:
|
region-list;region-list;...
|
For example:
defines two region groups. The first group is composed of regions
0, 1, and 2. The second group is composed of regions 3, 4, and 5.
focus-spec: Sets the focus to a region and automatically
unselects any other regions defined in the same group as the focus item.
The syntax looks like:
where the focus is assigned to region 'n'. And in a focus outline
drawn in an optional specified hex-color
(the default color is FFFF00 or yellow).
For example:
sets the focus to region 0, with the focus drawn in red (FF0000).
xy-spec: Sets the x,y location of the spot image within
the cpad GUI
The syntax is a point and looks like:
For an example of how to use 'spot' and 'xy', refer to the HTML source of
this example.
script --
Please refer to the
Native Scripting Manual
for complete details on how to use scripting in any Duckware applet.
Native scripting allows multiple applets parameters to be set via a script.
file-ref: A URL to a filename (in which case the entire file
contents are used), or a filename followed by ":sectionname" to
refer to a section of the file. For help using file sections, refer to the
Native Scripting Manual.
Since use of the ControlPad applet is almost always combined with
Native Scripting, please refer to the
Native Scripting Examples
for examples on how to use ControlPad.
|
Copyright © 2000-2008 Duckware
|
|