• 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
NSTextView, partial views of NSTextStorage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView, partial views of NSTextStorage


  • Subject: NSTextView, partial views of NSTextStorage
  • From: Jesse Grosjean <email@hidden>
  • Date: Fri, 14 Sep 2007 08:28:21 -0400

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?

Currently I'm doing it at the NSTextStorage level. I have a subclass of NSTextStorage that will observer and stay in synch with a subrange from another NSTextStorage. This works, but it's a bit complicated and it makes managing a universal undo stack hard since each NSTextView is associated with a different NSTextStorage.

Two other approaches that I haven't tried, but I would love to hear thoughts on...

1. First is it possible to subclass or tell NSLayoutManger to only work with a specific range and just layout that range in it's associated NSTextStorage? Using this approach I would just add a new NSLayoutManger to my NSTextStorage for each new NSTextView that I wanted. But by default it seems like NSLayoutMangers always like to start layout from the start of the NSTextStorage, and continue until the text views text container is full. I'd need a way to set hard start and end points.

2. Or if the above isn't possible is it possible to tell a NSTextView to just draw and edit a subrange of it's text and ignore the rest?

I'd love to hear thoughts on what solution would be best, and anything that I should be aware of before getting to deep into it.

Thanks,
Jesse
_______________________________________________

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


  • Follow-Ups:
    • Re: NSTextView, partial views of NSTextStorage
      • From: Uli Kusterer <email@hidden>
    • Re: NSTextView, partial views of NSTextStorage
      • From: Martin Wierschin <email@hidden>
  • Prev by Date: Re: Pages document
  • Next by Date: Core Data: Build a popup with different options on each line
  • Previous by thread: SOLVED: Determine pressed keys while dragging FROM OTHER application
  • Next by thread: Re: NSTextView, partial views of NSTextStorage
  • Index(es):
    • Date
    • Thread