ZooView
by Mary McNabb, NeXT Developer Support Team

Overview

In this application select a name from the list in the browser, and instantly see a photograph of that person!   This example creates a useful gadget called a SideSplitView. The SideSplitView object allows a window to be divided into two sections sitting side-by-side. The user can modify the widths of the size relative to one another just by dragging the divider. Somehow the appkit's NXSplitView overlooked the opportunity to be a more useful object by providing a setSideways: method. 

SideSplitView can be used to display and present information which has a left/right orientation rather than an up/down orientation.

Program Organization

How to build the nib files
The main window in the nib file contains 3 objects. The main object of interest is the SideSplitView object, which is created in IB by dragging out a custom view, and then changing its Class to be SideSplitView. SideSplitView must be connected to both of its subviews. The controller object must know the names of both of the subviews, and the SideSplitView. 

The controller object must be the delegate of the file's owner.

You must also add all of the tiff files to the project by dragging them into the Images suitcase in Project Builder.

User Interface
The glyph NXScrollKnob is used to indicate that the user can move the divider by dragging the knob with the mouse.

Major Classes in the Application
SideSplitView	The object of interest. Maintains two subviews and allows the user to modify their widths by dragging the divider. 

RightSubView	Simple knows the name of a tiff image and blits it to the screen.

Controller	This object is used to initialize certain aspects of the application. It also serves as the delegate for the browser.

Topics Of Interest
A Valiant Effort: One developer tried to implement a sideways splitview in another manner. He subclassed NXSplitView and then rotated the subviews counterclockwise 90 degrees and the NXSplitView clockwise 90 degrees. In this way you would expect to get a sideways splitview. This is a very clever solution, however, it doesn't work because the NXSplitView uses compositing for the dimple and for the sliding divider. Some of the subview objects use compositing as well. Since compositing is not affected by the current CTM of the view, and thus ignores the rotation, this solution didn't work.

Interactions withVertical Retrace: As the user is dragging the divider, the mouseDown: method  sleeps for a small period of time before compositing the divider in its new position. This is done because of an unfortunate interaction between drawing on the screen and the vertical retrace of the monitor.

When developing this example the dragging of the divider seemed slower and more susceptible to glitches than the NXSplitView. After some testing it became apparent that the compositing was happening incongruently with the vertical retrace of the screen. There is no good way around it. However, we did come up with an acceptable way. By waiting an amount of time within a retrace period, the movement of the divider was somewhat more smooth. It makes dragging the divider in some areas of the screen appear better, and some appear worse. A questionable win.

Other Files
*.tiff		Images to display. The filename minus the .tiff suffix must match the string in "animals".

Makefile		Files created by Interface Builder.
ZooView.iconheader
ZooView.nib
ZooView_main.m

PB.project

Change History

90 Sep 91		· Updated according to personnel changes.
		· Used MOUSEDRAGGED and MOUSEDOWN instead of LMOUSEDRAGGED and LMOUSEDOWN in mouseDown: method.
		· Used NX_COPY instead of NX_SOVER for the images. Still using SOVER for the dimple though.
		· Changed the color of the bar as it's being dragged.
		· Removed reference to non-public API.
14 July 93	· Updated to 3.0.  Uses Project Builder. 
		· Changed references to #import <appkit/Class.h> to				   #import <appkit/appkit.h>.

Valid for 3.0