|
 |
Example 2: an input device with a single line of code
For this example, open the configuration named "grid". It is
also a dgsl script which contains, aside of the component configuration part, only one
line of effective dgsl code:
image $level1@level1 $level2@(;level2;0<>300) pointer.gif
As you can see, this line draws the image pointer.gif on a position
which depends on level1 and level2 as defined by $level1 and $level2 (if these variables
are not set to a value, you won't be able to see the arrow. To set some values to level1
and level2, you can simply create two TextFields in the main window and connect them to
level1 and level2). But you can also see that the X and Y parameters are connected, on the
output, to the same variables (@level1 and @(;level2;0<>300)). By doing so, you can
move the arrow around in the grid. To move the arrow, click on it and keep the mouse
button pressed while moving the mouse. When you release the button, level1 and level2 are
set to the new X and Y position of the arrow. You'll see that you can not move the arrow
to the bottom of the grid. This is because the Y position has a lower limit of 0 and a
higher limit of 300.

If you have enabled the communication with the server and
if you have write access to the server (see "Installing the
package"), level1 and level2 will be changed locally and on the server.
If you have enabled the communication with the server but you do not have write
access to the server, then level1 and level2 will soon be set to the values they have on
the server. |