



First there was text-based (Rez) creation of 'view' resources for MacApp development. Then came ViewEdit: graphical creation of views. Simple 'view' format, simple tool. Next was IcePick, which pushed the state of the art of graphical editing systems, exploiting every nook and cranny of the MacApp 2.0 'view' definition with style, finesse and power. When MacApp 3.0 and the new robust and highly functional 'View' format came along, IcePick dropped the ball, to this day still not providing for direct creation of 3.0 views. The kludgy mechanisms provided by Apple to maintain compatibility with 2.0-view formats, coupled with the fact that use of the new view format provided substantial conceptual and productivity gains forced a reticent retreat to buggy, awkward yet 3.0-view-supporting ViewEdit.
Prayers for an alternative to ViewEdit for editing 3.0-views ostensibly had been answered with the introduction of Ad Lib. Arguably, it exploits all the goodies associated with 3.0 'View's, but with a confusing menu bar, scattered access to view attributes and some rough edges on the data entry mechanisms, it's certainly no panacea for view-editing woes. Put another way, it represents one step up and two steps back in MacApp view editing.
At first blush, apparently (and conspicuously) missing is the functionality of IcePick's famed 'Run-Time Mode', in which the views could be 'run' to see what they'd look like and how they'd perform (in limited ways), without having to incorporate them into an executable application. Instead, Ad Lib provides the means of attaching TAdorners, TBehaviors, TDrawingEnvironments, etc., to the views at the resource level (thanks to 3.0-'View's), and further provides what the documentation calls handlers "…[which] are powerful, general purpose behaviors that allow your views to respond to specific messages by sending new messages to various objects within your program." (Ad Lib Preliminary Documentation).
These handlers are somewhere in between TCommands and TBehaviors in their functionality. They respond to messages or triggers (e.g., button hits, menu selections), and consequently generate an event or perform a simple action.
Ad Lib allows for view run-time testing by using MacApp itself to run the prototyped views, along with their associated behaviors, adorners, handlers, and so on. Several source files ship with Ad Lib that extend MacApp to support behaviors-as-resources, as well as for attaching behaviors to the application object itself. To the point, a bare-bones TApplication-specifically, the derived class TBehaviorApp which ships with Ad Lib-becomes the testing environment for nascent views.
With MacApp 3.x, text strings and style information for views were moved into separate resources, allowing such information to be shared among any views in the application. Ad Lib does some serious bookkeeping for you with these resources, in that it checks for identical resources and opts to use those instead, eliminating redundancy. In Ad Lib, text and style information is entered directly, as you would in any word processor or text editor. This mechanism is far superior to ViewEdit's two-step method of creating text and style resources and associating them with views through resource IDs. Ad Lib will then create (or reference, if the resource already exists) the appropriate resources for you. There are some caveats to watch out for when editing these resources outside of Ad Lib, but Ad Lib uses an internal time-stamp and so can detect when changes were made by another editor. If the file was, in fact, changed by another appli-cation, Ad Lib suggests a rebuilding of the resource count tables (see Figure 3) before proceeding (this is highly advised in order to avoid text and style resource corruption).
The 'Prototyping Example' Folder contains the files necessary for building an application called ProtoApp. ProtoApp can be used as the environment for run-time testing of your views (and related resources) by adding the code for any behaviors you may have created and including your view resources to it.
Provided as an example of specific view testing is TestApp. By following the instructions in the README file, a ProtoApp is built and the specific view resources for TestApp are then simply rezzed into it.
After this dialog is dismissed, an empty window appears on the screen (see Figure 6 on the next page). With Ad Lib, windows are created like any other view, and displayed as such (unlike IcePick and ViewEdit, where the TWindow is a special case). To access or change the specific attributes of the window, open the Attributes windoid from the Window Menu. This floating window contains the only the most frequently accessed attributes of a TWindow. Here you can set size, position, title and WDEF number, among other basic things. To access the remaining TWindow attributes, go to the Object Menu's Class Hierarchy item. Here you will see, in reverse order, the complete inheritance of the currently-selected object (in this case, TWindow). Selecting from this hierarchical menu presents a dialog containing the specific definable fields (see Figure 7 on the next page). This mechanism presents some serious difficulties to the new Ad Lib user, since all attributes are not in any one place. Also notice that the information contained is not mutually exclusive (see Figure 7). ViewEdit's approach to this, while mechanically cumbersome, makes more sense to the user in that all view information can be accessed in one place.
Before creating any view hierarchy, Ad Lib's utility windoids should be used (available from the Window menu):
To make this window scroll properly, we need to create the familiar MacApp hierarchy: the main subview of the window is a TScroller, which extends from the origin of the content region to the topLeft of the GrowIcon; the TScroller should be set to sizeRelativeSuperView in both dimensions; and a single TView (sizeFixed or sizeVariable) drawn inside the TScroller that will serve as the root view for the enclosed view hierarchy. Ad Lib takes an interesting perspective on TScrollers: they are considered attachments to a view, like Adorners or Behaviors, not equals with other view types. Consequently, the approach to creating a scrolling view is this:
This is a lot of work to do, just to get basic scrolling into a standard Macintosh window. The process would be much more efficient here if access to attributes was collected into or accessible from a single place. The notion of a scroller being an attachment to a view turns out to be more encompassing than the traditional notion of TScrollers treated as just another view type: by attachment of a conceptual scroller, one gets the scrollbars and enclosed view as a single addition. Some mechanization of the process of attaching a scroller would also speed things up considerably. Ad Lib could easily prompt the user for all the necessary information, or better, have a canned scrollable view or window available.
In lieu of that, included on the Frameworks Disk Subscription for this issue is a file named 'Simple Window.view'. This file contains the view resource defined and created above.
The most glaring omission from Ad Lib's view editing arsenal is that of an outline view for traversing and editing the nascent 'View' hierarchy. Instead, it offers two distinct ways of accessing views-within-views, depending on whether the 'Subview Access' item in the View menu.
First, the view hierarchy can be 'flattened', so that all subviews are accessible by clicking on them while the 'Subview Access' item is on. This kind of direct access works in most cases, but can get cumbersome and even confusing when the hierarchical arrangement is crucial to the operation of the view (such as radio buttons within a cluster). For instance, if 'Subview Access' is on, newly added views become subviews of the view that they're dropped into. If 'Subview Access' is off, the views are added as direct subviews of the window (or topmost view, if there's no window). To add to the confusion here, views can be brought to the front or moved to the back, neither of which changes the actual view hierarchy.
The alternative way of traversing and editing the hierarchy is with the 'Subview Access' item off. In this 'mode', only the views which are direct subviews of the current view can be selected. When a view is selected and the View menu item 'Edit Subview' is chosen, a new window opens. This new window is a placeholder for the subviews of that selected view. In Figure 10, the window entitled "<TCluster>" represents the extent of the cluster behind it and contains the cluster's subviews, namely, three checkboxes.
While this second method clears up any ambiguities in hierarchical organization, for deep view trees the screen can get cluttered with stacked placeholder windows very quickly (anyone remember WordPerfect for Macintosh 1.0?)
By selecting multiple views, certain mathematical alignment operations can be performed on the views as a group. (Figure 11) While adequate for basic cases, this method of auto-alignment falls far short of IcePick's Aligning, Spreading and Same-Sizing of clustered controls/views.
Attachment of additional resources to the views is accomplished mostly from within the Object menu using various dialogs to supply needed information. Adorners and Behaviors are added by a similar mechanism. Through respective dialog boxes, they can be specified, added, removed and ordered. For example, in ViewEdit, the ordered firing of adorners was limited to 'First', 'Last', 'Before' or 'After'. Here, the order of adorners in the dialog's list determines the exact order in which adorners will be called (see Figures 12a, 12b). Plus, Ad Lib automatically adds an instance of THandlerBehavior (described above) to each view to which handlers have been added (see Figure 13). Simple attachments like Drawing Environments, Balloon Help references and text (where applicable) are available through equally simple dialogs.
Ad Lib handlers are also added through a dialog, but the purpose in adding handlers is to provide 'wiring' to your views for the run-time environment. Ad Lib supplies the code, handlers and message types for several common triggers: Apple Command, Command Key, Event, Idle, Initialize, Key Down, Key Up, Menu Command, Mouse Down, Mouse Up, Setup Menus and Update. The trigger type is selected from a popup menu and added to the handler list with a button click. Upon adding a trigger, additional information must be supplied, most importantly the action that this handler should take upon receiving the message. These actions are: Add Dependent, Close, Close & Free, Depends On, Doesn't Depend On, Enable Menu, Forward Message, Open Window, Pose Modal Dialog, Remove Dependent, Send Event, Send Menu Command, Send Update, Set User Value and User Defined. Most of these action types aren't documented (in the beta docs), but their meanings can be gleaned, if not simply by their name (e.g., Open Window) then by the nature of the information requested. A target must be specified in many cases (such as any of the 'Send…' actions). Valid targets are: Application, Document, Self, Subview, Superview, Target Chain, View, View (by Window), Window and Window (by ID). A short text description of the specific action can be supplied as well (see Figure 14).
This method of entry proves difficult in some situations because certain conventions must be followed to insure the proper flow of messages within the handler system. For instance, two handlers for each menu item must be created, namely a 'Setup Menu' handler to deal with enabling the menu item and a 'Menu Command' handler to dispatch the message to the proper resources and targets. For each of these operations, the user must not only be sure that all menu items are taken care of, but that a dummy handler forwards the message to 'self' (for those times when the message is to be resignaled or wasn't serviced by any handler). If you have a solid grasp of MacApp-style event handling chains, there really isn't a conceptual problem here. The difficulties arise in entering all this information through a dialog/list interface. Graphical entry of the messaging passing/routing chains would make more sense here.
Also included on the Frameworks disk is 'Complex Window.view'. It includes a simple window (containing a TPicture), the complex-view window described above, and a handful of other resources that were required as add-ons to ProtoApp:
After adding these resources to the Ad Lib .view file (and having already built ProtoApp), it was a simple task of Rezzing it together with the ProtoApp file to produce a working application (drag the files 'Complex Window.view' and 'Amoco.r' to the 'Prototyping Examples' Folder within your Ad Lib folder)-far less effort than I had originally expected.
Small, but important, improvements can be made in automating some of the tasks into gestalts. For instance, in the creation of a scrolling view, the user could be prompted for pertinent information at the time the scroller is attached to a given view (and this is yet another place that better access to attributes would help, with or without automation).
However, I don't feel comfortable in ending a review of Ad Lib with criticism. It's a fine first version, and its coverage of 3.0-View enhancements is impressive indeed. Some of the paradigms it introduces, while not altogether traditional or standard, work quite well once grasped.
Given the current choices-use ViewEdit, go the IcePick->ViewPromoter->manual-hacking-of-view-attachments route, or get Ad Lib and use it immediately-well, there really is no question. And, for now, there really is no other editor besides Ad Lib. n
Thanks to G. Gordon Apple for his postings on AppleLink demonstrating certain caveats and to-dos associated with attaching scrollers and with post hoc deleting of scrollbars. Thanks also to Tom Tulinsky for prompting certain specific investigations into Ad Lib.



