FROM : b.bum
DATE : Sun Oct 31 20:31:00 2004
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
DATE : Sun Oct 31 20:31:00 2004
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
| Related mails | Author | Date |
|---|---|---|
| Mike Bolton | Oct 31, 08:08 | |
| b.bum | Oct 31, 20:31 |






Cocoa mail archive

