(no subject)
(no subject)
- Subject: (no subject)
- From: Max J Cantor <email@hidden>
- Date: Mon, 21 May 2001 13:42:18 -0400 (EDT)
I did this, and finally got the text to not wrap, however, the text that
doesn't fit in the TextView is simply invisible, the TextContainer doesn't
grow to fit it. (the horizontal scrollbar is still disabled). I set it
to be horizontally scrollable, but that didnt help. Is there any way to
have it scroll horizontally without settign the minimum horizontal size
myself?
-Max
On Wednesday, May 16, 2001, at 03:52 PM, Christopher Lloyd wrote:
NSTextView actually represents a group of objects, NSTextView,
NSTextContainer, NSLayoutManager, NSTextStorage and others. The text and
attributes (fonts, colors, paragraph style) are stored in an
NSAttributedString/NSMutableAttributedString, in this case, a subclass
named NSTextStorage which is specific to the NSTextView system.
So, something like...
NSRange range=NSMakeRange(myStartLocation,theLength);
NSTextStorage *textStorage=[myTextView textStorage];
NSMutableParagraphStyle *paragraphStyle=[[NSParagraphStyle
defaultParagraphStyle] mutableCopy];
[paragraphStyle setLineBreakMode:NSLineBreakByClipping];
[textStorage addAttribute:NSParagraphStyleAttributeName
value:paragraphStyle range:range];
Will do about what you want. You might actually want to see if there is an
existing paragraph style in that range and modify it. If you are doing a
lot of changes you probably want to use the beginEditing/endEditing
methods of NSMutableAttributedString to speed things up.
Hope this helps,
Chris
At 01:24 PM 5/16/2001 -0400, Max wrote:
Could you be more specific, I couldn't discern exactly what you mean.
Should I just make an attributed string with the attribute being the
paragraph style? And then set that attributed string to the NSTextView
with setStringValue?
On Wednesday, May 16, 2001, at 12:37 PM, Christopher Lloyd wrote:
Check out NSParagraphStyle, this can be an attribute in an
NSAttributedString. So in this case you'd create a default paragraph
style, make a mutableCopy, set the lineBreakMode to NSLineBreakByClipping
(maybe NSLineBreakByTruncatingTail), then set it as an attribute on the
NSRange of characters your interested in on the NSTextView's
NSTextStorage.
At 12:20 PM 5/16/2001 -0400, Max wrote:
I have an NSTextView which I need to display text like a browser would
handle a <pre> </pre> tag. Namely, I dont want it to wrap the text. I
can't find anything in the api's to set this.
Anyone have any idea how to do this?
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev