One of the more enjoyable parts of developing Mac software is the venerable about box. Some like to have fun with it and add goofy company names and credit distant relatives or caffeine-soaked foodstuffs. Others prefer to keep their about box serious, clean and no-nonsense. Whichever type of developer you are, it may not be completely obvious how to edit the information which is automatically inserted into your project’s default about box. Particularly if you’ve started fresh with a new one and didn’t clone one of Apple’s example projects.
At build time, Project Builder will insert the information from your “InfoPlist.strings” file into the default about box. (Note the default about box will not appear in Interface Builder as its own window. This window is a behind-the-scenes sort of object and is auto-magically handled for you based on the information you’ve entered into the appropriate places.) [See Fig. 1]
Figure 1. - [em]InfoPlist.strings settings[/em]
Now, if you’d like to add additional textual information to the about box, you may do so by adding a “Credits.rtf” file to your project. The best part is that Project Builder already knows to ‘look’ for such a file and inserts its contents into the about box, if the file exists. If not, PB doesn’t care and will build the about box without it.
First, create a text file in OS X’s TextEdit application. Lucky for most starving amateur programmers, it comes free with OS X. Next, type and format your text and save the file as “Credits.rtf”. [See Figs. 2, 3] The file name is important and it’s case sensitive, so be sure to type it exactly that way. TextEdit’s default file format is ‘rtf’ and it will flag you if an attempt is made to save it otherwise or to use a file extension like ‘txt’.
Figure 2. -[em]Create an RTF text file.[/em]
Figure 3. - [em]Save as “Credits.rtf”[/em]
Next, open your project in Project Builder and choose “Project → Add Files…” from Project Builder’s menu bar.[See Fig. 4]
Figure 4. - [em]PB’s “Add files” menu.[/em]
Navigate through the resulting dialog and find your “Credits.rtf” file. Select it and click “Add”. You will then be presented with the following dialog [See Fig. 5]
Figure 5. - [em]“Add Files” dialog.[/em]
For the purposes of this tutorial, we’re going to skip the next two settings.Leave “Reference Style” at the “Default” setting and leave “Recursively creategroups for any added folders” selected in that set of radio buttons.
Our final step is to select our ‘target’ under the “Add To Targets” list. Inmost beginner projects, there will be only one target which happens to be named something remarkably close to the name of your application. Just be sure thistarget is highlighted and selected. If your project has multiple targets, youprobably don’t need this tutorial anyway and should be solving problems likeworld hunger or discovering anti-gravity.
Finally, click “Add”. After you’ve added your credits file, you’ll see it in the left-hand pane of your Project Builder window. [See Fig. 6]
Figure 6. - Added credits file in your Project Builder window.
Also, have a look in your project’s folder in the Finder and you should see the “Credits.rtf” file has been copied there, according to your settings in the previous step. [See Fig. 7]
Figure 7. - Added credits file in your project’s folder.
Now, build and run your project and select the “About…” menu option. You should then see your enhanced dialog, including the information contained within your credits file. [See Fig. 8b]
Figure 8a. - Our revised About box before.
[b]Figure 8b. - [b]Our revised About box after.
Some developers use fancy graphics and pictures in their about boxes. You can do this in a very simple form by dragging images into your document within TextEdit and saving your credits as “Credits.rtfd” instead. Your pictures will show up inline with your text. It’s not pretty, but it works. [Thanks, JJ!]
This concludes the current edition ofunscripted. Although it isn’t necessary to include me in your own about box, we never say no to a link back to MacScripter! Be well and we’ll see you next time.