Apr 92 Tips
Volume Number: | | 8
|
Issue Number: | | 1
|
Column Tag: | | Tips & Tidbits
|
Tips & Tidbits
By Dave Mark, Neil Ticktin, Editor
Starting with this issue, MacTutor has a new column called Tips and Tidbits. This column is your opportunity to spread the word about little bits of information that you find out about. These tidbits can be programming related, as you will see in the Tip of the Month, or they can be user tips that are particularly useful to programmers.
The tips in this first issue came from Dave Mark from our Getting Started column. The MacTutor staff will continue to come up with tips for a little while, but we really want to hear from you. MacTutor will pay $25 for every tip used, and the Tip of the Month will receive $50. To submit a tip, send in a letter to the magazine. Remember, AppleLink is our preferred method of communication, but feel free to send something via US Mail. If you do send mail, enclose a printed copy and a disk copy of the letter so that it does not have to be retyped.
Let us know what you think. Remember, this is your magazine. Try em out and let us know...
Hidden deep inside System 7, there are a set of 3 Toolbox traps so secret, they arent even included in the THINK C interfaces. The three routines are SetDialogDefaultItem(), SetDialogCancelItem(), and SetDialogTracksCursor(). To access these three routines, include these three declarations at the top of your source code file:
/* 1 */
pascal OSErr SetDialogDefaultItem( DialogPtr theDialog, short newItem
) = { 0x303C, 0x0304, 0xAA68 };
pascal OSErr SetDialogCancelItem( DialogPtr theDialog, short newItem
) = { 0x303C, 0x0305, 0xAA68 };
pascal OSErr SetDialogTracksCursor( DialogPtr theDialog, Boolean tracks
) = { 0x303C, 0x0306, 0xAA68 };
SetDialogDefaultItem() allows you to specify a dialogs default item. More importantly, it will ensure that the thick, rounded rectangle is drawn around the default item, something you normally do yourself.
SetDialogCancelItem() ties an item to the key sequence command-period. Typically, youll want to tie this functionality to the Cancel button.
Finally, SetDialogTracksCursor() tells the Dialog Manager to use the i-beam cursor when the cursor enters an editable text field.
Forcing a Quit
Under System 7, if you hold down the command and option keys and then press the escape key, you can force an application to quit. This key sequence brings up a dialog box, asking if youd like to force a quit. Be careful with this, as youll lose any unsaved changes. This technique works, no matter what application you are in.
Now heres the cool part. In the Finder, hold down the command and option keys and press the escape key. When the dialog box appears, click the Force Quit button, but continue to hold the command and option keys down. The Finder will restart, asking you if youd like to rebuild the desktop database on all available volumes. Pretty slick, huh?
Custom Finder Icons
You can create custom Finder icons for any file under System 7. Go into the Scrapbook and copy your favorite PICT image into the clipboard. Back in the Finder, click on any icon, then select Get Info from the File menu. When the Get Info window appears, click on the icon in the upper left corner of the window. A 1 pixel border should appear around the icon. Select Paste from the Edit menu. Youve just added a custom icon to the file. You can read about custom icons in Inside Macintosh, Volume VI on page 9-28.