macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Modifying Stickies
Pages: 1, 2, 3, 4

Add a Drawer

Interface Builder makes it easy to add a drawer to nearly any window. Stickies windows are no exception. In the following steps, you'll discover how to add a drawer to your disclose button.

  1. Return to Interface Builder.

  2. Select the disclose button in the Window Editor. Open the Connections palette in the Info Editor (CMD-2) and scroll until you see toggleRuler:.

  3. Click disconnect. The dot next to toggleRuler: disappears. The disclose button is no longer connected to that function.

  4. In the Palettes window, click the fourth button at the top of the toolbar line. This reveals the Cocoa-Windows palette.

  5. Drag the top-right icon, the one of a window with a drawer, onto your nib window.


Add new windows to an application by dragging them from the Windows Palette.

  1. Locate the three new items that appear in your nib window: Parent Window, DrawContent, and NSDrawer.

  2. Select Parent Window and press delete to remove it from your nib window.

  3. Control-drag from the NSDrawer to the Window.


Control-dragging tells Interface Builder to create a new connection from the NSDrawer to the Window.

  1. In the Info Window's Connections palette, double-click parentWindow. A dot appears to the left of parentWindow. Doing this tells Interface Builder that the NSDrawer is the child of the Window and that the Window is the parent of the NSDrawer. This relationship helps Interface Builder know which drawer to show for each window.

  2. In the nib window, double-click DrawContent... to open the DrawContentView editor window.

  3. In the Palette, click the fifth button in the toolbar to open the Cocoa-Containers palette.

  4. Drag a box onto the DrawContentView editor window.


Boxes help organize related controls.

  1. Double-click the word Box and change it to "Stickies Controls." Then resize the box to provide more room to put controls inside. Feel free to make it nice and roomy. If it turns out too large, you can always readjust the size later.

  2. In the palette, click the second button on the toolbar to open the Cocoa-Controls palette.

  3. Drag three buttons and a checkbox into the Stickies Controls box. Edit their names to Check Spelling, Show Guess Panel, Print, and Show Ruler and arrange according to your tastes.


Dragging controls into a box helps arrange those controls with a bit of visual flair.

  1. Control-drag from the (currently unconnected) disclose button in the Window editor to the NSDrawer icon in the nib window.

  2. In the Info Editor's Control palette, double-click toggle:. A dot appears next to the word toggle: when the connection is complete. Now, instead of toggling the ruler, the disclose button will toggle the drawer.

  3. Control-drag from each button and checkbox in the drawer to the TextEdit area in the Window editor. Connect the Show Ruler checkbox to toggleRuler:; connect Check Spelling to checkSpelling:; connect Show Guess Panel to showGuessPanel:; and connect Print to print:.

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

  5. Return to the Stickies application.

  6. Open a new Sticky (CMD-N) and test the updated disclose button. When clicked, it now opens the drawer that offers all the functionality you added with the new controls. Give it a try and confirm that everything works as expected.


After modding, Stickies now provides a secret drawer with extra controls.

In Summary

The mods shown in this article offer just a taste of the end-user customization possibilities available with Interface Builder. Hopefully, this brief tour will whet your appetite and encourage you to learn more about this excellent tool.

Restoring Stickies to Itself

To restore your application back to its original state, remove Stickies from your dock and then delete the modified version of your Stickies application in /Applications. Rename "Stickies copy" to "Stickies" and you're set. The copy stored an unmodified version of your application. By renaming it "Stickies," it becomes the standard Stickies application.

If desired, for the pedants among us, launch a terminal shell and change the ownership back to root as follows: sudo chown root:admin Stickies.app.

Erica Sadun has written, co-written, and contributed to almost two dozen books about technology, particularly in the areas of programming, digital video, and digital photography.


Return to MacDevCenter.com.