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

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

From: Walter Lenk <Walter_Lenk@...>
Date: Sun, 12 Apr 2009 11:29:24 -0400
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.

Thanks to all who replied,

Walter

-- 

===========================================
Walter Lenk    Cambridge Ma    617-547-7781
===========================================