Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Macintosh handles Keywords: handle, TextEdit, FSWrite Message-ID: <8071@hoptoad.uucp> Date: 20 Jul 89 04:23:00 GMT References: <1044@clinet.FI> <8043@hoptoad.uucp> <1409@unix.SRI.COM> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Distribution: comp.sys.mac.programmer Organization: Eclectic Software, San Francisco Lines: 35 In article <1044@clinet.FI> maa@clinet.FI (Miika Asunta) writes: >2) How can I store a TEstylehandle entirely into a file? Is > the following (written in pseudo-code) enough: > FSWrite n bytes , pointer (TEstylehandle^) In article <1409@unix.SRI.COM> stores@unix.UUCP (Matt Mora) writes: >Tim, think he wants to save the style information not just the text. Oops, look like you're right. I haven't used the styled textEdit yet (it seems pretty pointless until they get rid of the length limits, frankly) and so I just read right over that. >I haven't used the new TE styles yet butI read the chapter awhile ago >and i think it mentions somthing about a new scrap type 'styl' that >you might be able to save in the resource fork. I suppose that could work, but I just did a little looking and it appears that Miika was correct. All the style information is stored in a single handle which could be written out to a file by a single FSWrite call. However, as you imply, it might be better to write it to a resource instead. That way you can have a plain text file in the data fork with associated style information in the resource fork. But again, this would only be really useful if Apple eliminated the size limitations, both tacit and overt. The 32K limit is bad enough, but in practice, handle resizing overhead (and, I suppose, line array maintenance) makes text edit records impossibly slow at lengths as small as 2K. Yech. TextEdit does a lot of really nice stuff, and I just wish they'd make it useful for something other than the Dialog Manager. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Those who restrain desire, do so because theirs is weak enough to be restrained..." - Blake, "The Marriage of Heaven and Hell"