[futurebasic] Re: [FB] Adding 'styl' resource to MLTE EF

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2009 : Group Archive : Group : All Groups

From: "H. Gluender" <h@...>
Date: Sun, 12 Apr 2009 18:19:23 +0200
Dear Walter,

because the list is slow these days I should like to comment on your 
perfectly compiled state of the discussion below. I must admit 
however that I have no experience with (styled) text.


>I wrote:
>>  I have been working on inserting a 'TEXT' resource and it's associated
>>  'styl' resource into an MLTE edit field.........
>
>Robert P. replied:
>>  A 'styl' resource is as obsolete as the original Mac TextEdit API.....
>
>I wrote:
>>  ..... create a temporary .rtf file
>>  .... using FN TXNNewObject to display it
>>  This works fine, but ...  is a bit clunky.
>>  Is there a way to put the .rtf data directly into an MLTE field?
>
>Robert P. replied:
>>  _kTXNRichTextFormatData = _"RTF "
>>  err = fn TXNSetData( txtObject, _kTXNRichTextFormatData, [textResHndl],
>>   fn GetHandleSize( textResHndl ), _kTXNStartOffset, _kTXNEndOffset )
>
>Unfortunately, fn TXNSetData returns an error with kTXNRichTextFormatData
>
>I then searched the web using the key words 'TXNSetData' and 'rtf', and
>found 2 postings that seemed to verify this:
>
>>  I don't think TXNSetData supports kTXNRichTextFormatData. I have some
>>  code that handles this situation by writing the text to a temporary file
>>  and then using TXNSetDataFromFile. (Under Tiger, I suppose the
>>  recommended thing would be TXNReadFromCFURL.)
>>    James W. Walker, ScriptPerfection Enterprises, Inc.
>>    <http://www.write-brain.com/>
>
>>  TXNSetData does not support kTXNRichTextFormatData data (rdar://4512691),
>>  and so for this format we have to write the data out to a temporary file.
>>    refNum Software <http://www.refnum.com/>
>
>Waverly Edwards forwarded me a May 19, 2008 posting from Robert P. (Re: [FB]
>FBtoC Help Window), and a  September 23, 2008 posting from Ken S. ([FB] Re:
>FBtoC: non-scrolling but styled text) that use TXNSetDataFromCFURLRef and
>TXNReadFromCFURL respectively. Unfortunately both of these examples read
>the .rtf data from a file, not a 'TEXT' resource.
>
>The temporarily file routine that I am using is clunky, but does the job -
>I guess that I'll stick with it until I learn a better way.

Evidently, the non-function of Apple's constant 
"kTXNRichTextFormatData" is annoying but isn't your styled text 
available as a file anyway? Why do you have to stick with 
old-fashioned resources in the resource fork? Why not use a bundled 
application in which your text would be accessible as rtf by -- I 
guess -- one of the above mentioned calls?

As far as I know, a bundled application may even consist of a mix of 
old-fashioned resources in the resource fork and bundled resources, 
but I may be wrong. If this is true, then using a bundled text file 
would not imply to bundle other resources.

>Thanks to all who replied,
>Walter
>--
>===========================================
>Walter Lenk    Cambridge Ma    617-547-7781
>===========================================

Happy Easter holiday to you and our list fellows!

Hope to learn more
-- 

                   Herbie

          ------------------------
          <http://www.gluender.de>