Re: NSTextView, partial views of NSTextStorage
Re: NSTextView, partial views of NSTextStorage
- Subject: Re: NSTextView, partial views of NSTextStorage
- From: Uli Kusterer <email@hidden>
- Date: Sat, 15 Sep 2007 10:51:54 +0200
On 14.09.2007, at 14:28, Jesse Grosjean wrote:
I have a text view, and I want it to just display and edit a
subrange of it's associated NSTextStorage. For example lets say my
text storage has 10 paragraphs, but I just want my NSTextView to
display and edit one of them. I also need the solution to scale to
multiple NSTextViews, so for example one view will be viewing
paragraphs 2-3, while another might be viewing paragraphs 3-4.
I'm wondering what the best way to approach this problem is?
Have you thought about just creating a substring of the full text
view and editing that? Syncing the two ranges by copying back and
forth when either is edited should be less trouble than trying to
share a text storage and keeping it restricted to a particular range.
Though I think someone on this list once asked about sharing the
same text storage between several NSTextViews and got it solved ...
maybe you could let the user view, but not edit, the other ranges?
You could for example apply a custom (temporary?) style attribute to
the characters that tells you which view can edit a particular piece
of text, and then use shouldChangeTextInRange: to enforce that. Would
that perhaps work better?
Just listing alternatives, as it sounds like one *should*
conceptually be able to do this on the NSTextxxx level.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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