Updated with TextEdit to closely match the sample application given in Inside Macintosh