FROM : Nebagakid
DATE : Tue Jan 21 23:20:28 2003
Thank you very much y'all. I am gonna check out the documentation on
this, as well as the sample code (that is all I have until I get my
book from Amazon)
-Danny Cohen
On Tuesday, January 21, 2003, at 05:17 PM, j o a r wrote:
> No, you're of course not "talking crazy" - but you need to understand
> that the text system is the most complex set of classes in all of
> Cocoa. The basics is easy, and I have a feeling that what you ask for
> is not very complicated - but don't expect to get a tutorial of the
> Cocoa text system in an email on this list. You _need_ to take the
> time to read the documentation and play with the sample code until you
> get to grips with it.
>
> If you have a specific question on something that you need to do, or
> something that you don't understand in the documentation, it would be
> easier for us to help you.
>
> It sounds to me that what you're asking for below is the ability to
> grab the formatted contents of a NSTextView, to be able to store it or
> use it outside of the text view? Like Douglas and Chris already told
> you, the answer is to be found in NSTextView, NSText (Don't forget to
> read the documentation for superclasses!), NSTextStorage and
> NSAttributedString.
>
> Something like this will create a copy of the current contents of a
> text view named "myTextView":
>
> NSAttributedString *aStr = [[NSAttributedString alloc]
> initWithAttributedString: [myTextView textStorage]];
>
> This will create a serialized representation suitable for archiving:
>
> NSData *data = [myTextView RTFDFromRange: NSMakeRange(0, [[myTextView
> textStorage] length])];
>
> This will restore serialized data to a text view:
>
> [myTextView replaceCharactersInRange: NSMakeRange(0, [[myTextView
> textStorage] length]) withRTFD: data];
>
> ("Programmed" in Mail, watch out!)
>
> j o a r
>
> On Tuesday, Jan 21, 2003, at 22:35 Europe/Stockholm, Nebagakid wrote:
>
>> What I am looking for, for example, is a way to take the entire
>> contents of an NSTextView (with different colors, fonts, even
>> pictures) and be able to put that into one string with just saying "I
>> want this variable to be equal to the Rich Text of this Text View"
>> .... Am I talking crazy here (I am really new at Cocoa) ?
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Tue Jan 21 23:20:28 2003
Thank you very much y'all. I am gonna check out the documentation on
this, as well as the sample code (that is all I have until I get my
book from Amazon)
-Danny Cohen
On Tuesday, January 21, 2003, at 05:17 PM, j o a r wrote:
> No, you're of course not "talking crazy" - but you need to understand
> that the text system is the most complex set of classes in all of
> Cocoa. The basics is easy, and I have a feeling that what you ask for
> is not very complicated - but don't expect to get a tutorial of the
> Cocoa text system in an email on this list. You _need_ to take the
> time to read the documentation and play with the sample code until you
> get to grips with it.
>
> If you have a specific question on something that you need to do, or
> something that you don't understand in the documentation, it would be
> easier for us to help you.
>
> It sounds to me that what you're asking for below is the ability to
> grab the formatted contents of a NSTextView, to be able to store it or
> use it outside of the text view? Like Douglas and Chris already told
> you, the answer is to be found in NSTextView, NSText (Don't forget to
> read the documentation for superclasses!), NSTextStorage and
> NSAttributedString.
>
> Something like this will create a copy of the current contents of a
> text view named "myTextView":
>
> NSAttributedString *aStr = [[NSAttributedString alloc]
> initWithAttributedString: [myTextView textStorage]];
>
> This will create a serialized representation suitable for archiving:
>
> NSData *data = [myTextView RTFDFromRange: NSMakeRange(0, [[myTextView
> textStorage] length])];
>
> This will restore serialized data to a text view:
>
> [myTextView replaceCharactersInRange: NSMakeRange(0, [[myTextView
> textStorage] length]) withRTFD: data];
>
> ("Programmed" in Mail, watch out!)
>
> j o a r
>
> On Tuesday, Jan 21, 2003, at 22:35 Europe/Stockholm, Nebagakid wrote:
>
>> What I am looking for, for example, is a way to take the entire
>> contents of an NSTextView (with different colors, fonts, even
>> pictures) and be able to put that into one string with just saying "I
>> want this variable to be equal to the Rich Text of this Text View"
>> .... Am I talking crazy here (I am really new at Cocoa) ?
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Nebagakid | Jan 21, 13:46 | |
| Douglas Davidson | Jan 21, 19:20 | |
| Nebagakid | Jan 21, 22:35 | |
| Douglas Davidson | Jan 21, 22:46 | |
| Chris Hanson | Jan 21, 22:48 | |
| j o a r | Jan 21, 23:17 | |
| Nebagakid | Jan 21, 23:20 | |
| Nebagakid | Jan 22, 00:26 | |
| Nebagakid | Jan 22, 04:17 | |
| j o a r | Jan 22, 07:01 |






Cocoa mail archive

