Vispatch Tutorial (using Java 1.02) > TOC > The Vispatch Visual Language > Bodies of Rules > Events that Specify Rule Scopes

Events that Specify Rule Scopes

By using dispatch figures, it is possible to specify that rules in a certain scope be used to process specific event figures. To associate an event figure to a certain scope, two dispatch figures must go from each end of the drag event figure to a third dispatch figure. The third dispatch figure is linked to some scope figure, either directly or through a chain of dispatch figures. For click event figures, a simple chain of dispatch figures can be used to connect the click event figure to the scope figure that should process it.

For example, the Vispatch program below demonstrates this technique for two of the drag event figures. This causes the program to process events in two different ways. The lower scope figure draws a fractal tree starting at the event location. The upper scope figure draws a spiral starting at the event location. By having the upper scope figure process one of the events in the tree-drawing rule, a spiral is created for every branch in the tree.

 
If you draw a large tree, you can demonstrate that events processed by the upper scope figure are not bound by the scope figure on the left. Events that create the spiral will be processed no matter whether they are located in another scope figure or not. Therefore line segments that make up the spirals can appear completely outside of all scope figures.