AppSketcher: The Instance Viewer


When you ask for a new module (through AppSketcher's New Module command in the app's main menu), AppSketcher presents a new, empty Instance Viewer.

The Instance Viewer is a repository for the objects that you want to add to your module. To add an object, you drag the desired class item from the Class Viewer and drop it into the Instance Viewer. (Note, however, that the Class Viewer isn't the only provider of class items; see the Class Viewer documentation for more information on this point.)



The item that appears in the Instance Viewer represents an instance of the dropped class. To the right we see the aftermath of dragging a BApplication object into the Viewer.





The "Class:" text above the Viewer's left column displays the class of the "currently selected object." The "Name:" form presents the name of the selected object; a default name is conjured for you when you drop an object. You can change the name to suit your tastes; here we change the name of the BApplication object to "MyApp".

The name that you assign to an object is the name by which it's known to the LRModule object within your application. You can pass the name to LRModule's FindInstance() function to find a particular object.
You can drag any class of object into your Instance Viewer: You aren't restricted to just windows and views (for example). Nonetheless, dropping a window object into your Instance Viewer is usually one of the first things you do:

When you drop a window object into the Instance Viewer, an "Interface Window" appears. At this point, you can build your module by dragging class items directly into the Interface Window.
The Instance Viewer and the Interface Window are more or less equivalent: When you drop an object into the one, an item appears in the other (with some exceptions).

The rest of this document describes the features and functions of the Instance Viewer and Interface Window.


The Container Hierarchy


The Instance Viewer's column layout expresses a container hierarchy:
An object that's displayed in a particular column in the Instance Viewer is "contained" within the object that's displayed in the next column to the left. The container hierarchy is similar to the view hierarchy-- it's actually a superset of the view hierarchy in that it can represent a view hierarchy and also lets you add non-view objects as well.

The Instance Viewer maintains and displays a current selection upon which the Viwer's menu commands operate. The current selection is drawn in dark gray; the hierarchical path that leads to the selection is shown in light gray (the light gray-drawn items are called "path" objects). To set the current selection, you simply click on the desired item in the Viewer.

You can also set the current selection by control-clicking an object in the module's Interface Window. The Instance Viewer will automatically scroll (if necessary) to the object's column so it can be seen.

The Instance Viewer shown above displays part of the container hierarchy for the module in the Samples/Sample1 directory. Notice that the the selected item, "File", is a BMenuItem object. This object isn't a view, yet it's interposed between two objects that are views: BMenuBar to the left, and BMenu to the right.

When you drop a class item into an Instance Viewer, the column over which you drop the icon is significant: The object is added to that column, and the "container parent" is the path object in the next column to the left. For example, let's add a BTextControl to the BView object shown in the Sample1 Instance Viewer. We get a BTextControl out of the Class Viewer and drop it into the column to the right of the BView. The result looks like this:

Notice that a recently dropped object is automatically selected.


Manipulating Objects


Here we see the module's Interface Window after the text control object is dropped. Obviously, we'll want to move the control around and resize it:
To move an object in the Interface Window, you simply click within the object's bounds and drag it where you want it. To indicate that it read your click, AppSketcher turns the corners of the clicked-on object blue.

To resize, you grab a corner or edge of the object and drag. When you grab part of an object for resizing, AppSketcher draws that part in red.


Here, the top button is about to be resized horizontally.

The Instance Viewer maintains and displays a current selection upon which the Viwer's menu commands operate. The current selection is drawn in dark gray; the hierarchical path that leads to the selection is shown in light gray (the light gray-drawn items are called "path" objects). To set the current selection, you simply click on the desired item in the Viewer.

You can also set the current selection by control-clicking an object in the module's Interface Window. The Instance Viewer will automatically scroll (if necessary) to the object's column so it can be seen.



Copyright ©1997 BeatWare Incorporated. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of BeatWare, Inc. is prohibited. Be is a registered trademark, and BeOS, BeBox, BeWare, GeekPort, the Be logo and the BeOS logo are trademarks of Be, Inc. All other trademarks mentioned are the property of their respective owners.
Comments about this page? Please write us at webmaster@beatware.com.
All rights reserved.