README -- Presto Tool Box % Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO. % All Rights Reserved. % Disclosure without explicit written consent from the % copyright owner does not constitute publication. % Version of 03-Nov-1999 08:17:54. % Updated 14-Dec-1999 14:34:50. The "PS" Class Presto's "ps" class provides a framework for handling events generated by interactive graphical components in Matlab-5. Users are expected to derive their own class from the "ps" class and then provide a "doevent" method to overload the basic "ps" behavior, as needed. Methods for creating menus, controls, and user-defined properties are included. How Presto Works The "ps" constructor writes a "ps" object into the "UserData" of the graphical entity to which it will be attached, typically a "figure". Key callbacks of the associated graphical components are forced to invoke "psevent the_callback_name" whenever they are manipulated with the mouse. The "ps" object itself is extracted from the GUI, and its "doevent" method is called as "doevent(self, the_callback_name)". In the case of menus and controls, the callback-name is translated to the tag of the particular item before the "doevent" method is invoked. The basic "doevent" method is a "switch" ladder, which uses the names of the callbacks to decide how to act upon any request. User-Defined Properties Users may set and get additional properties of their own choosing for each "ps" object, using the standard "dot" syntax associated with Matlab "struct" entities. Interestingly, if the requested property happens to be an actual graphical property, it is instituted directly. Thus, whether dealing with a GUI property, or a user-defined property, the same "dot" syntax works for both. Indeed, the "ps" subscripting abilities are versatile, unlike the Matlab "set/get" commands. Example: p = ps(anyFigure) p.myColor = [0 1 1] p.color = p.myColor Menus In "ps", uimenus are created with the "menu" method, whose second argument is the name of the menu-item, suitably prefixed with an indication of where it lies in the menu heirarchy. When enables, these menus call the "event" method, which cleans up the name before deciding what to do. For example, "Open..." is translated into "open" before the switch-ladder is executed. Controls The "control" method allocates uicontrols, whose layout is defined in normalized units, plus pixel offsets. Whenever a "ResizeFcn" event occurs in "presto", all such controls are themselves resized to fit the new figure geometry. This scheme is very important for preserving the appearance of the figure, an ability not otherwise available in Matlab. Standard scrollbars are created using the keywords "right", "bottom", "left", and "top" as the style-name in the "control" method. This facilitates immensely the otherwise difficult burden of positioning Matlab scrollbars (sliders).