• 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
Text System perplexity. Use Swing instead?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text System perplexity. Use Swing instead?


  • Subject: Text System perplexity. Use Swing instead?
  • From: Jonathan Hendry <email@hidden>
  • Date: Thu, 15 Nov 2001 16:18:31 -0600

Howdy. I'm trying to decide whether to use Cocoa
to write something, or if perhaps the Swing text system
would be better. The Swing text system is rather
better documented, and might be architected more
conveniently.

However, if anyone could provide some Cocoa text system
help, I'd appreciate it.

I think I want to use custom attributes in the NSTextStorage.
A document will be read in and tags will be converted to
attributes. Those attributes should be rendered in a text
object as an uneditable label, telling the user what to
type at that location. When they select that position,
the label disappears.

Think Mad Libs, where you have a paragraph of text
with blanks containing a label like <adjective>
or <verb> mixed in with the text. Something like
that.

My impression is that this would require a subclass of
NSLayoutManager, which could interpret the custom attributes
and insert the appropriate label text. How this is done
is not remotely obvious, and it gets into Glyphs which
aren't really covered anywhere.

An alternate implementation might make the labels
attachment cells. Might that work better?

[Swing would probably require writing a new EditorKit,
and providing some new View subclasses that could handle
the custom attribute. They have an example EditorKit
that would help.]

Any suggestions, tips, hints, private Apple code,
or other wisdom would be appreciated.

Thanks,

JH


  • Follow-Ups:
    • Re: Text System perplexity. Use Swing instead?
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: Table view with widgets inside
  • Next by Date: Re: Opening NSDrawer on app startup
  • Previous by thread: An "interesting" bug involving NSDistributedNotifications
  • Next by thread: Re: Text System perplexity. Use Swing instead?
  • Index(es):
    • Date
    • Thread