Apple II
File Type Notes
_____________________________________________________________________________
                                                  Developer Technical Support

File Type:         $50 (80)
Auxiliary Type:    $5445

Full Name:     Teach Document
Short Name:    Teach document

Written by:    Matt Deatherage                                     March 1990

Files of this type and auxiliary type contain TextEdit-based documents.
_____________________________________________________________________________

With the advent of TextEdit for the IIGS, many small text-editing applications 
have suddenly appeared.  Apple may wish to release such a utility with the 
System Software in the future, and has defined this simple file format for the 
use of such a utility (referred to as "Teach" after the Macintosh program 
"TeachText" by Bryan Stearns) and the use of any other text-editing program.

The file format is eminently suitable for a Text Edit record, and applications 
should feel free to save any Text Edit record using this file format.  The 
auxiliary type is the ASCII letters "TE".

The Data Fork

The data fork of a Teach document contains ASCII text.  All 256 characters are 
allowed.  The data fork should not contain anything that shouldn't be 
interpreted as ASCII text (for example, no data structures or pointers to 
lines, etc.).

The Resource Fork

The resource fork of a Teach document contains two resources.  The first 
resource is of type rStyleBlock ($8012) and has ID $00000001.  This resource 
contains all the style information for the text contained in the data fork.  
Each Teach document must contain this resource.  Programs that use Teach 
documents may pass the resource ID $00000001 to TextEdit calls that require 
TEFormat data structures, which is the data structure contained in an 
rStyleBlock resource.  If this resource does not exist, passing the ID to 
TextEdit could bring the system down.

The second resource is of type $7001 and has ID $00000001..This resource 
contains window position information.  If the TextEdit record contains a ruler 
which is tied to the window position (so the text rewraps when the window is 
resized), when an application saves the record, it must include this resource.  
In the same respect, if this resource exists in a Teach file, an application 
must use this resource to set the window position and size.

Warning:  If an application fails to follow either of these steps, 
          TextEdit may hang.

The format of this second resource is as follows:

Height     (+000)    Word    The window height in pixels.
Width      (+002)    Word    The window width in pixels.
Top        (+004)    Word    The y coordinate of the window's top.
Left       (+006)    Word    The x coordinate of the window's left edge.
Version    (+008)    Long    Version number.  Must be set to zero.

Other resources should not be placed in Teach documents.  Any program saving a 
document could delete an older file with the same name instead of rewriting 
it, causing any other resources to be lost.


Further Reference
_____________________________________________________________________________
  o  Apple IIGS Toolbox Reference, Volume 3

