Here is the other email that I recall about RTF.
Hopefully it helps,
W.
-----Original Message-----
From: Ken Shmidheiser [mailto:kshmidheiser@...]
Sent: Tuesday, September 23, 2008 9:19 PM
To: futurebasic@...
Subject: [FB] Re: FBtoC: non-scrolling but styled text
Mark asked:
> How should I modify or replace the
> scrolling text view example so that I can show a text file ( .rtf
> file) with styled text in a non-scrolling field?
Mark,
This assumes you are creating your "fields"-- or views-- in Interface
Builder using a nib, rather than creating them programmatically.
Use a Text View (HiTextView) and don't embed it in a Scroll View. You
can then create the TNXObject from your RTF file and put it into the
view (AKA "Edit Field").
Once you get the hang of HiTextViews, you won't want to look back. A
single line of code can copy the view's contents to and from the
Clipboard and there are functions available to do all sorts of clever
things with the view's TXNObject, whether it be text or a picture,
Ken
Here's some quick pseudocode to give you the concept:
dim as HIViewRef @ myTextView, myRoot
dim as OSStatus ignore
dim as CFURLRef theUrl
dim as TXNObject txnObj
// Get the window which contains your HiTextView (AKA "Edit Field")
myRoot = fn HIViewGetRoot( window (_wndRef) )
// Locate the field/view in your window where you want to put your
RTF text
ignore = fn HIViewFindByID( myRoot, kHIViewWindowContentID.signature,
kHIViewWindowContentID.id, myTextView )
// Locate the RTF file...
// (In this example it's a file called "test.rtf"
// in your application bundle)
// ... and ID it with a CFURLRef
theURL = fn CFBundleCopyResourceURL( fn CFBundleGetMainBundle(), fn
CFSTR( "test.rtf" ), 0, 0 )
// Once you have the CFURLRef...
long if (theURL )
// Create a TXXObject for data in your selected view
txnObj = fn HITextViewGetTXNObject( myTextView )
// Grab the RTF data and put it into your HiTextView via the view's
TXNObject
ignore = fn TXNReadFromCFURL( txnObj, _kTXNStartOffset,
_kTXNEndOffset, 0, theURL, #0 )
// Empty the trash
CFRelease( theURL )
end if
--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________