Re: Trouble finding bounding rect of NSAttributedString

2009-11-20 Thread Jens Alfke
On Nov 19, 2009, at 9:20 PM, Dave DeLong wrote: > However, in both of these methods, the attributedString of the textview is > nil, thus giving me the strange results I'm seeing. How are you getting the attributedString out of the textview? (I'm guessing by calling -textStorage.) If so, that s

Re: Trouble finding bounding rect of NSAttributedString

2009-11-19 Thread Dave DeLong
Your question has caused me to dig deeper... It seems that when I handle both the NSViewFrameDidChangeNotification and the NSTableViewSelectionDidChangeNotification notifications, the attributedString of the textView's layout manager is nil. This is very interesting... Here's a bit more of my

Re: Trouble finding bounding rect of NSAttributedString

2009-11-19 Thread Jens Alfke
On Nov 19, 2009, at 2:39 PM, Dave DeLong wrote: > When I print out the size or rect that these return, I invariably get either > {0, 0} or something absurd like {{1.17076e-318, 2.29357e-314}, {2.30359e-314, > 2.1224e-314}} (that's just running the rect through NSStringFromRect()) Make sure the

Re: Trouble finding bounding rect of NSAttributedString

2009-11-19 Thread Dave DeLong
Good point. When I print out the size or rect that these return, I invariably get either {0, 0} or something absurd like {{1.17076e-318, 2.29357e-314}, {2.30359e-314, 2.1224e-314}} (that's just running the rect through NSStringFromRect()) Dave On Nov 19, 2009, at 3:37 PM, Jens Alfke wrote: >

Re: Trouble finding bounding rect of NSAttributedString

2009-11-19 Thread Jens Alfke
On Nov 19, 2009, at 1:28 PM, Dave DeLong wrote: > I have an NSTextView that I need to resize dynamically. NSTextView appears > to resize itself as I add text, but I also need it to shrink itself as I > delete text. Here's what I've tried: Several of those look like reasonable calls for this

Trouble finding bounding rect of NSAttributedString

2009-11-19 Thread Dave DeLong
Hi everyone, I've been struggling for several hours to get the bounding rectangle of an NSAttributedString when drawn at a particular width. I have an NSTextView that I need to resize dynamically. NSTextView appears to resize itself as I add text, but I also need it to shrink itself as I delet