Re: Laying out text in NSTextView around a subview
Re: Laying out text in NSTextView around a subview
- Subject: Re: Laying out text in NSTextView around a subview
- From: Jason Brennan <email@hidden>
- Date: Tue, 30 Apr 2013 10:01:02 -0400
Yeah what I'm trying to do mostly is a "block" element in the text,
"inline" is just a side thing, not essential. What I'm trying to do is best
described as an analogy with HTML.
Let's say I've got the following HTML:
<p>This is a paragraph</p>
<img/>
<p>Another paragraph</p>
I'm only using <img> as an example because it's a block element. It goes on
its own line and moves with the paragraphs (if, ex, the first paragraph
grew). I know I can use NSTextAttachments for a "block image", but in my
case I want this to be any NSView because it requires interaction.
So, I need to be able to embed a block element in a text view and have it
move with the text. There should be no text on the same line as the NSView.
I feel like with NSTextContainer or NSLayoutManager but I can't quite
figure out what the right combination is. I've read the Text Layout
Programming guide but I feel no closer to knowing.
Thanks for the help so far!
Jason
On Mon, Apr 29, 2013 at 3:01 PM, Seth Willits <email@hidden> wrote:
> On Apr 29, 2013, at 11:08 AM, Seth Willits wrote:
>
> >> What I’m trying to do is have an NSTextView and add custom NSView
> subviews to it, but have it so the text can layout around the subviews.
> >
> > You need a custom text container. See
> http://developer.apple.com/library/mac/#samplecode/TextLayoutDemo/Introduction/Intro.html
>
>
> I re-read this.
>
>
> Do you want something like Xcode's inline errors (when the error bubble is
> under the line of code with the problem)? The text flows around it, but you
> also want that bubble to move with a particular bit of text?
>
> You'll still need a custom text container to manage text flow around the
> block, but I think you'll probably want to combine that with a text
> attachment which gives you the location in-text of that block and a storage
> mechanism. The text attachment is not critical, but would be useful since
> the character location of that block would automatically move when the text
> storage is edited.
>
>
> --
> Seth Willits
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden