ADVANCED TOPICS
Portals are a special type of item in Pad++ that sit on the Pad++ surface with a view onto a different location. Because each portal has its own view, the surface might be visible at several locations, each at a different magnification, through various portals. In addition, portals can look onto surfaces of other Pad++ widgets. See the description of Portal Items in the reference manual, as well as the description of the bind command for more information about portals.
It is possible to attach event handlers to items on the Pad++ surface so that when a specific event (such as ButtonPress) is applied to an item, an associated command is executed. This system is similar to the way that the Tk bind command uses events to associate commands with widgets; but the Pad++ bind command has several significant additions. The extensions fall into the following three categories (See the pad bind command in the Pad++ Reference Manual for complete details):
In addition to the event bindings that every item may have, every Pad++ item can define Tcl scripts associated with it which will get evaluated at special times. There are four types of these callbacks:
A render callback script gets evaluated every time the item is rendered. See the -renderscript itemconfigure option for more detail.
A timer callback script gets evaluated at regular intervals, independent of whether the item is being rendered, or receiving events. See the -timerscript and -timerrate itemconfigure options for more detail.
A zooming callback script gets evaluated when an item gets rendered at a different size than its previous render (the relevant size thresholds are definable). This is a simple way of making "semantically zoomable" items (i.e., items that look different when they are rendered at different sizes). See the -zoomaction itemconfigure option for more detail.
A view change callback gets evaluated whenever the view onto the Pad++ surface changes (as a result of commands such as moveto, center, etc.). See the -viewscript itemconfigure option for more detail.
It is possible to add user-defined types and options to Pad++ entirely with Tcl scripts (i.e., no C/C++ code). This provides a mechanism to define new compound item types that are treated like first-class Pad++ items. The user-defined types can be created, configured, saved, etc., with the same commands you use to interact with built-in items such as lines or text. These extensions are particularly well-suited for widgets, but can be used for anything. See the Application-Defined Item Types and Options section above for a detailed description.
Pad++ has several methods for producing animations. The moveto command animates the view of the surface to any new point in a specified time. Individual items can be animated with either render or timer callbacks, the -place itemconfigure option, or the slide command. Finally, panning and zooming is animated under user-control, defined by scripts supplied with the PadDraw application.
All automatic animations use slow-in-slow-out motion. This means that the motion starts slowly, goes quicker in the middle, and ends slowly. This results in smoother feeling animations. slow-in-slow-out does not affect the amount of time that the animation takes because time is effectively stolen from the middle to put at the ends. User-controlled animations are specified precisely by the user, and there is no distortion in the speed of the motion.
Generated with Harlequin WebMaker