extending an NSTextView shape
extending an NSTextView shape
- Subject: extending an NSTextView shape
- From: Michael Hanna <email@hidden>
- Date: Wed, 1 Mar 2006 13:54:28 -0800
Hello, after the user enters an NSString, I have it displayed in an
NSView subclass the same way it is done in Sketch sample code
(SKTTextArea.m)
I use the -setContents: method to put the string in the text view. I
can successfully do this, and I use
NSAttributedString -size and pass it to -setBounds: to set the width
of the text area, but the height gets truncated like this:
http://img303.imageshack.us/img303/2718/textareatooshort8va.png
I'm not sure how to set the bounds to the size of the text. Is that
the bounds of the textcontainer? If so I have tried something like
this in setContents:
NSLayoutManager *lm = sharedDrawingLayoutManager();
NSTextContainer *tc = [[lm textContainers] objectAtIndex:0];
NSSize newSize = [tc containerSize];
NSRect currBounds = [self bounds];
currBounds.size = newSize;
[self setBounds:currBounds];
but the first line gives me a warning:
warning: initialization makes pointer from integer without a cast
not sure what this means. Is that route a dead-end? Any suggestions?
I'm essentially using the SKTTextArea.m code unchanged.
Mike
--
Mike Hanna
email@hidden
iChat: michaelkhanna(AIM)
_______________________________________________
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