Adding a New Button

In this example, you’ll add a new button to the Terminal’s interface that, when clicked, will clear the scrollback within the Terminal window. In order to make room for this new button, you’ll compress the height of the scrollbar.

  1. Close the ContextMenu menu editor if it’s open.

  2. Open the Terminal design window by double-clicking Term in the NIB window.

  3. Select the scrollbar on the right side of the Terminal design window. It appears to the right of the TermSubview. Small, light-blue resize handles appear around the scrollbar. The Info window’s titlebar updates to NSScroller (Custom) Info.

  4. Hold down the Shift key and resize the scrollbar so that it shrinks vertically without changing horizontally. Resize the scrollbar to about half its former size.

  5. Click at the very top of the column (just below the titlebar) to select the split-view button.

  6. Choose Edit Duplicate (⌘-D) to create a new copy of this invisible button.

  7. Drag the invisible button copy down just below the original and watch until the guides (shown in Figure 7-23) appear. These guides ensure that the new button appears just below the original, aligned within the column.

    Watch for these guidebars to appear when you reposition the new button

    Figure 7-23. Watch for these guidebars to appear when you reposition the new button

  8. With the new button selected, open the Attributes pane in the Info window (⌘-1).

  9. In the Attributes pane, check the Bordered box. An outline appears around the new ...

Get Modding Mac OS X now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.