Re: horizontal sizeToFit of NSTextView or NSTextField

2008-04-21 Thread Manfred Schwind
Either I'm misunderstanding your question, or you're misunderstanding the Geometries code. I think you want - widthForHeight:attributes:, with the height specified for three lines (could just take it from what IB sets for you, or first get a heightForWidth:reallyBig, then triple that). The

Re: horizontal sizeToFit of NSTextView or NSTextField

2008-04-21 Thread Jack Repenning
On Apr 20, 2008, at 11:37 AM, Manfred Schwind wrote: Getting the height of a text for a given width is easy and I've done that countless times. Also getting the width of a string (layed out in one line if it has no newlines) is no problem. But I have a different problem. I try to give an ea

Re: horizontal sizeToFit of NSTextView or NSTextField

2008-04-20 Thread Gary L. Wade
If you wish to vary both the width and height to be a more pleasing set of dimensions, similar to what an alert does, try word wrapping your text into a golden ratio rectangle using the area measurement generated by your single-line text measurement. Of course, based on a strict interpretation

Re: horizontal sizeToFit of NSTextView or NSTextField

2008-04-20 Thread Manfred Schwind
Now I want to be able to calculate the optimal width of the view so that the entire text is visible. This worked wonders for me: http://www.cocoabuilder.com/archive/message/cocoa/2008/3/31/202752 This also does not solve my problem. Getting the height of a text for a given width is easy and

Re: horizontal sizeToFit of NSTextView or NSTextField

2008-04-19 Thread Jack Repenning
On Apr 19, 2008, at 8:31 AM, Manfred Schwind wrote: Now I want to be able to calculate the optimal width of the view so that the entire text is visible. This worked wonders for me: http://www.cocoabuilder.com/archive/message/cocoa/2008/3/31/202752 -==- Jack Repenning [EMAIL PROTECTED] Proj

horizontal sizeToFit of NSTextView or NSTextField

2008-04-19 Thread Manfred Schwind
I have a view that has a fixed height and that should be filled with text (at runtime, but the text keeps static once set). Now I want to be able to calculate the optimal width of the view so that the entire text is visible. The text may wrap around. I tried a zillion things with NSTextView a