[comp.sys.mac.programmer] Exporting Styled Text Inf

Ken.Knight@f421.n109.z1.fidonet.org (Ken Knight) (01/30/91)

I'm asking this for a friend, but please send replies to this address.
 
I need to save styled TextEdit information to disk. That means, the
TERecord and its associated Style reocrd along with the text itself.
There doesn't seem to be any standard way of doing this that I can
find. However, in ResEdit 2.1 there is an 'styl' resource that seems to
contain just this information. However, I can't find any information on
the format of this resource (ResEdit uses a resource edit, not
template, to handle the resource). It appears to be an undefined
resource as far as the resource files that came with MPW 3.1 are
concerned. So, is there a standard way to export (and , of course,
import) this information? If not, what have you people done in this
regard.
 
Internet: ken.knight@f421.n109.z1.fidonet.org               AOL:
KenKnight
BBS: Twilight Clone 301-946-8643 @ 9600 HST or -5032 9600/v.32: Ken
Knight


--  

        Ken Knight, Ken.Knight@f421.n109.z1.fidonet.org
      via The Black Cat's Shack's FidoNet<->Usenet Gateway
          blkcat.fidonet.org   and   Fidonet 1:109/401

mxmora@unix.SRI.COM (Matt Mora) (01/31/91)

In article <3215.27A6A774@blkcat.fidonet.org> Ken.Knight@f421.n109.z1.fidonet.org (Ken Knight) writes:
>I'm asking this for a friend, but please send replies to this address.
> 
>I need to save styled TextEdit information to disk. That means, the
>TERecord and its associated Style reocrd along with the text itself.

You should get the book "Programming the Macintosh II" by David a Wilson.
It comes with source code examples on how to do what you want. This book
looks like its just viewgrafs from a seminar he gave but the source is usefull.

I think what you need to do is save three parts of the style records 
seperatly. Below is an example.

		To save a style record:
		
		styleRecHdl := GetStylHandle(textH);
		styleTableHdl := styleRecHdl^^.styleTab;
		lhTableHdl := styleRecHdl^^.lhTab;
		
		To restore a style record:
		SetStylHandle(styleRecHdl, textH);
		styleRecHdl^^.styleTab := styleTableHdl;
		styleRecHdl^^.lhTab := lhTableHdl;
		
















-- 
___________________________________________________________
Matthew Mora                |  my Mac  Matt_Mora@QM.SRI.COM
SRI International           |  my SUN   mxmora@unix.sri.com
___________________________________________________________