• 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: Disk Utility's NSTextView psuedo-column display
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disk Utility's NSTextView psuedo-column display


  • Subject: Re: Disk Utility's NSTextView psuedo-column display
  • From: "b.bum" <email@hidden>
  • Date: Sun, 31 Oct 2004 11:31:00 -0800

On Oct 31, 2004, at 12:08 AM, Mike Bolton wrote:
I'm trying to implement an extended information view
in my app, similar to how Apple provides two-column
extended information on disk images/drives in the Disk
Utility program, at the bottom of the window, in an
NSTextView.

I'm not very familiar with formatting NSTextViews, so
I was hoping that someone could tell me how they
imagine this sort of NSTextView layout would be
implemented, or point me in the right direction. I've
been reading up on NSParagraphStyles and NSTextTabs,
but I'm really not sure if this is what I should be
looking at, or perhaps there may be a much easier way
to obtain this type of display. Any information is
greatly appreciated.

Yup. It is a pain. Tedious, but easy.

I have done this a bunch of times but can't find a code snippet.

(1) Download Text Extras and install http://www.lorax.com/FreeStuff/FreeStuff.html

(2) Create a TextEdit RTF document that contains an example -- a thorough example -- of exactly how you want the text to look in your application

(3) Use Text Extra's debugging tool to dump the state of the NSTextView

(4) Write code that configures NSMutableParagraphStyle(s) with the appropriate styles, fonts and tab stops. Basically, you are writing code that, when applied to an attributed string and shoved into an NSTextView, will yield a Text Extras debugging dump just like the one you produced from Text Edit.

(5) Apply the style to an attributed string containing the text you want to display and shove it in the text view

I generally end up with three styles:

The page style: This is applied to the attributed string to set up the "page" attributes.

The heading style: This is applied to attributed strings that act as column headers (i.e. one string per entire row of headers)

The body style: This is applied to each "row" in the table

And, optionally, some other styles to define various formatting for specific strings.

b.bum


_______________________________________________
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
References: 
 >Disk Utility's NSTextView psuedo-column display (From: Mike Bolton <email@hidden>)

  • Prev by Date: Re: Variable Scope (again)
  • Next by Date: NSCell spanning columns
  • Previous by thread: Disk Utility's NSTextView psuedo-column display
  • Next by thread: Variable Scope (again)
  • Index(es):
    • Date
    • Thread