Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView autoresizing vertically



Hi,


I have created an NSTextView of a given size that one
can type into. If you type more than can fit into the
text view, I would like it to extend vertically to
show the additional text. I have spent some time on
this problem with no success. It should be a fairly
easy task.



- (void)textChanged:(NSNotification *)notify
{
	NSSize			textSize = [[textView
layoutManager]usedRectForTextContainer:[textView
textContainer]].size;
	NSSize			textViewSize = [textView bounds].size;
	
	
	if ( textSize.height + 10.0 > textViewSize.height )
	{
		[textView setFrameSize:textSize];
	}
}



This code gives an odd error message:

Exception raised during posting of notification. 
Ignored.  exception: -[NSLayoutManager
_fillGlyphHoleAtIndex:desiredNumberOfCharacters:] ***
attempted glyph generation while textStorage is
editing.  It is not valid to cause the layoutManager
to do glyph generation while the textStorage is
editing (ie the textStorage has been sent a
beginEditing message without a matching endEditing.)


Thanks  :)


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.