macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Modifying Stickies
Pages: 1, 2, 3, 4

Exposing Stickies

Although OS X applications look like single files, they are not. There's more to Mac OS X applications than meets the eye. Mac OS X applications aren't files. They are actually folders that contain one or more executables and their supporting resource files. They appear to the end-user as a single file because the Finder treats them as a bundle. Bundles are folders that look like files and whose contents are hidden from the user.

In order to modify the Stickies application, you must start by opening the application bundle and exposing the elements that lie within.

  1. Return to the Finder and open a new Finder window (CMD-N). Go to the Applications folder (Shift-CMD-A), and then select the Stickies application.

  2. Control-click (right-click) on the Stickies application icon to display the Finder's contextual pop-up menu. Choose Show Package Contents. The Finder opens up a new window that contains a single folder, Contents.

  3. To view what's within the Contents folder, press the C key and then select View -> as Columns (CMD-3). Opening the folder exposes the various materials that form the application bundle.

  4. Navigate beneath Contents to Resources -> English.lproj. Here, you'll find the files that make up the Stickies interface, including StickiesDocument.nib, the file that defines the way each Stickies window looks. Each lproj folder refers to a localization, which provides a language-specific version of each program.


Opening up a bundle reveals the various folders and files that contribute to an application.

  1. The nib file extension refers to Interface Builder files. Double-click StickiesDocument.nib to launch Interface Builder and open the file within it.

Meeting Interface Builder

Although Interface Builder may look daunting to new users, it's really very simple. Interface Builder is composed of just a few key components that allow you to layout and customize application interfaces. A little bit of hands-on experience helps these tools to make sense. After opening StickiesDocument.nib in Interface Builder, you'll find the following windows on-screen.


Interface Builder's windows let you change the way Application windows look and behave.

NIB File Window

This window contains all the items in your nib (interface) file, including windows, menus, and other interface objects.

Palette

The palette contains samples of all the interactive elements you can add to windows. These elements, called controls, include buttons, text fields, sliders, and more.

Info

The Info Editor offers context-sensitive options for all the elements found in your nib file.

Window Editor

This window lets you edit the look and layout of your application.

Adding Scrollbars

Making Stickies windows scrollable is very easy to do. In the following steps, you'll see how to convert your windows.

  1. Launch Stickies by double-clicking the Stickies icon in your dock. Stickies actually re-reads the source nib files each time it opens a new window, so you can work on your application "live", checking the changes by opening new windows.

  2. In Stickies, open a new window. Paste more text into the window than you can possibly see at a time. As you'll discover, Stickies does not add a scrollbar to help you navigate through the text.


Stickies does not automatically add scrollbars when a Sticky's text exceeds the size of the note.

  1. Return to Interface Builder. In the window editor, click once on big white area in the middle. Selection handles appear around this area, which is called an NSTextView. Do not move or change this area. Simply select it.


The big white area in the middle of the Stickies window is called a "TextView."

  1. In the Info Editor, if it is not already selected, choose Attributes from the pop-up menu at the top. This palette shows all the editable attributes for the selected TextView.

  2. Locate the checkbox that says Show Scroller and check it. As you do so, the item just beneath it becomes enabled. Check Automatically Hide Scroller as well. This combination of options only shows the scrollbar when there is additional material to scroll to. Otherwise, the scrollbar will not appear.

  3. Choose File -> Save (CMD-S) to save your changes to disk.

  4. Return to the Stickies application.

  5. Create a new window and add the same material you put in the first Sticky note. This time, Stickies adds a scrollbar as needed, allowing you to scroll through the text.


After setting the scrollbar flags, Stickies now adds scrollbars when needed.

Pages: 1, 2, 3, 4

Next Pagearrow