Classic Computer Magazine Archive COMPUTE! ISSUE 74 / JULY 1986 / PAGE 108

INSIGHT: ST

Bill Wilkinson

This month we're going to explore a handful of quirks in the GEM desktop: things you can do to make your system more useful...things you can do to make your system crash! Since I'm a natural-born pessimist, let's start with the crash.

The bug I'm about to demonstrate infests the ROM (Read Only Memory) version of the TOS operating system. Even so, if you don't already have the TOS ROMs, get them today. The difference in overall system performance and capability is only a little short of great.

To see this bug, simply boot your system and bring up the Control Panel. Select either the date or time field. Then type an underline character (SHIFT-hyphen). Watch your system bomb. The only recovery is to press the reset button or turn off the power.

Problem: The Control Panel is a form of dialog box, and it uses what are known as editable text fields to display and let you modify the date and time. An editable text field is designed to restrict the user to typing certain characters. For example, the date and time fields of the Control Panel are editable fields which allow only numbers to be typed. Unfortunately, somehow a bug crept into the ROM-based TOS. Anytime you edit a numeric-only field, typing the underline causes something nasty to occur. Editable fields for filenames have a similar, though usually nonfatal, problem.

Solution: A GEM application program that needs to accept numeric-only input from the user has two choices: (1) Use an editable field which allows any character and then validate the user's input after the dialog box returns; (2) Retrieve keystrokes one at a time, checking them on the fly, and print only the valid ones on the screen. The former solution is kind of ugly because the user doesn't get immediate response to incorrect input. The latter solution is a lot of work. Take your pick.

Modifying DESKTOP.INF

Many of you already know how to customize the GEM desktop so your preferences appear automatically when you boot up the ST. When you select the Save Desktop item under the Options menu, GEM saves a file to the disk in drive A called DESKTOP.INF which stores these preferences. You can rearrange the icons on the screen, change screen colors, resize the windows, and so on, and GEM remembers it all for you.

DESKTOP.INF is an ordinary ASCII file, so it can be modified with most text editors and word processors. This lets you personalize GEM even more. (See "ST Hints & Tips," COMPUTE!, June 1986.)

The first thing we'll do is the easiest. Using a text editor or word processor that handles ASCII files, load and examine DESKTOP.INF. You should see one or two lines which contain the words FLOPPY DISK (among other things). These are the labels which appear beneath the disk icons. I usually rename the labels --Top--Disk-- and Bottom--Disk. (I've used dashes here to show where I typed a space--magazine typesetting sometimes makes it hard to indicate spaces.)

Save the modified file back on disk in ASCII format. The next time you boot from that disk, the names should appear as you have modified them. Just for fun, sometimes I change the name of the trash can to Junk! or Garbage or something equally silly.

Rearranging Files

There are even more interesting things you can do with DESKTOP.INF. If, like me, you have a disk or subdirectory in which you do most of your work, you'll soon find that you can't see all of the filenames or icons on the screen at once. Although it's a minor nuisance, it always seems that the files (or, more likely, programs) which I want the most are always off the screen. How can we force them back on the screen? Preferably in the upper-left position?

One solution, since the default display mode under the Show menu is Sort by Name, is to name your favorite files AARDVARK.PRG or AAABASIC.PRG. But that's kind of messy. A better method might be to choose Sort by Date if you could change the file's creation date. But I think Mark Rose (of Optimized Systems Software) has hit upon the best scheme.

First, he chooses Sort by Type. Second, he renames his most-used programs so they have no type (filename extension) at all. Third, he loads DESKTOP.INF and adds a line or so. To figure out exactly what to add, look for a line in DESKTOP.INF similar to this:

#G 03 FF *.PRG@@

This line tells the desktop that all files which match the *PRG specifier are GEM (G) program files. Now, let's say the program you want to appear at the top-left of the screen was called PASCAL.PRG and has been renamed to simply PASCAL. You would add this line to the end of the DESKTOP.INF file:

#G 03 FF PASCAL.@@

This tells GEM that PASCAL is actually a GEM-based program. Neat, huh? What's more, you can do this for several files. However, I do not recommend using the *. wildcard in such a line--general untyped files end up looking like programs, a dangerous practice.