• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom Objects in an NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom Objects in an NSTextView


  • Subject: Re: Custom Objects in an NSTextView
  • From: Aki Inoue <email@hidden>
  • Date: Wed, 4 Jan 2006 10:23:30 -0800

Manfred,

I believe implementing a custom NSTextAttachmentCell can serve your purpose. NSTextAttachment allows your to specify an arbitrary an NSCell instance that conforms to the NSTextAttachmentCell protocol. You can start exploring from http://developer.apple.com/documentation/ Cocoa/Conceptual/TextAttachments/index.html

Phil,

If you want text that flows around objects, you will need to use more than one text view each with its own custom text container that defines a bounding rectangle. Hooking up these multiple views so that text editing done in one is reflected in the other ain't easy. Read about the NSTextStorage and NSTextContainer classes.
You don't need to create multiple NSTextContainer/NSTextView to do this. You can have a custom NSTextContainer that returns line fragments flow around your layout objects. And, besides, coordinating multiple NSTextContainer/NSTextView hooked to an NSLayoutManager is automatic.

Aki

What you're asking for is not supported in any simple way by the cocoa text system.

If you want text that flows around objects, you will need to use more than one text view each with its own custom text container that defines a bounding rectangle. Hooking up these multiple views so that text editing done in one is reflected in the other ain't easy. Read about the NSTextStorage and NSTextContainer classes.

If you find an easy way to do it, let me know. I'd kill for embedded images whose text flows.

An alternative might be to use a custom WebView. You could make it editable and maybe (?) override some methods to support object resizing and whatnot.

-Phil

On Jan 4, 2006, at 5:41 PM, Manfred Schubert wrote:

I would like to insert custom objects into an NSTextView. The objects need to flow with the text, they need to be able to change size and respond to clicks. How would I do that? I couldn't find hints in the documentation on how to implement and neither any sample code, so I would be glad if someone could point me to where to start.


Thanks

Manfred
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Custom Objects in an NSTextView
      • From: Philip Dow <email@hidden>
References: 
 >Custom Objects in an NSTextView (From: Manfred Schubert <email@hidden>)
 >Re: Custom Objects in an NSTextView (From: Philip Dow <email@hidden>)

  • Prev by Date: Re: perform ... afterDelay? [solved]
  • Next by Date: Re: perform ... afterDelay? [solved]
  • Previous by thread: Re: Custom Objects in an NSTextView
  • Next by thread: Re: Custom Objects in an NSTextView
  • Index(es):
    • Date
    • Thread