Copyright ã1996 by NeXT Software, Inc.  All Rights Reserved.

;GroupingObjects.rtfd;;¬  Next Section	;MovingObjectsToOtherWindows.rtfd;;¬  Previous Section

Arrangingobjects;¬Arranging objects

1	Choose Format ¬ Align ¬ Alignment to bring up the Alignment panel.

2	Set the characteristics of the grid in the Alignment panel.

3	Choose Format ¬ Align ¬ Turn Grid On to turn on the grid.

4	Align objects with the grid.

When you compose your interface, you usually want to arrange the objects in that interface in some appealingly regular way. You want buttons, for instance, to be aligned on the same invisible horizontal or vertical line. Or you want the distance between text fields in a form application to be exactly the same. Interface Builder gives you a set of tools for arranging objects.

Every window or panel has a grid associated with it. You may turn this grid off and on. When it is on and you move an object, an edge of that object ªsnaps,º like a nail to a magnet, to the adjacent intersecting lines of the grid. 

You set the dimensions of this grid and the edges of alignment in Interface Builder's Alignment panel.

¬

The buttons in the Align section of the Alignment panel determine what point or edge of interface objects snaps to the grid. 

¬

Once you have your grid set up, make sure the grid is turned on: Choose Format ¬ Align ¬ Turn Grid On. If you also want the grid visible, choose Show Grid from the same menu. 

Now align the objects, either individually or as a group, using the grid.

¬

There are other ways to align objects that don't require using the mouse. With the grid turned off, you can drag view objects from a palette and visually align them as precisely as possible. Then set the grid spacing, turn the grid on, and choose the Align to Grid command.

Once the grid is set and on, align the objects, either individually or as a group.

¬

With the Align to Grid command, the direction of alignment is toward the origin point of the window or panel (in other words, toward the lower-left corner). You should be aware of this when placing objects for later alignment. 

Tip: You can align selected objects to a grid, singly or as a group, by pressing the arrow keys in the direction of alignment. When the grid is turned on, the unit of increment changes from one pixel to whatever the grid spacing is.

Making Columns and Rows of Objects

It is more efficient to align groups of objects than to align single objects successively. With the Make Column and Make Row commands, Interface Builder aligns groups of selected objects to a reference object. You designate the reference object by the way you select multiple objects.:

¬	If you press the Shift key while clicking objects in succession, the first object clicked is the reference object.

¬	If you draw a selection rectangle around a group of objects, and so select objects simultaneously, the topmost object in the selection (often the most recently added object) is the reference object.

For most purposes, Shift-clicking objects is the preferred method because it permits more control.

¬