Return to Snippet

Revision: 2978
at May 19, 2007 16:04 by iloveitaly


Initial Code
#import "NSTextView+Wrapping.h"

// references:
//	http://developer.apple.com/documentation/Cocoa/Conceptual/TextUILayer/Tasks/TextInScrollView.html#//apple_ref/doc/uid/20000938-164652-BCIDFBBH
//	http://www.cocoabuilder.com/archive/message/cocoa/2003/12/28/89458


@implementation NSTextView (Wrapping)
- (void) setWrapsText:(BOOL)wraps {
	if(wraps) {
		// implement later
	} else {
		NSSize bigSize = NSMakeSize(FLT_MAX, FLT_MAX);
		
		[[self enclosingScrollView] setHasHorizontalScroller:YES];
		[self setHorizontallyResizable:YES];
		[self setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
		
		[[self textContainer] setContainerSize:bigSize];
		[[self textContainer] setWidthTracksTextView:NO];
	}
}
@end

Initial URL

                                

Initial Description

                                

Initial Title
Disable Word Wrapping in NSTextView

Initial Tags

                                

Initial Language
Objective C