Scrollable NSTextView
Scrollable NSTextView
- Subject: Scrollable NSTextView
- From: Daniel Delp <email@hidden>
- Date: Tue, 22 Oct 2002 12:03:15 -0500
I am attempting to put a scrollable NSTextView into an NSView
programmatically. I found a page on the apple developer site that told
how to do this and copied almost word for word for initial testing. The
TextView does show inside the scrollview, but when the text goes beyond
the end of the initial size, it does not scroll or even make the scroll
bar visible. Here is the code I was working when I realized this (This
is all inside an NSView):
NSTextView *chatView;
NSScrollView *scrollview = [[NSScrollView alloc]
initWithFrame:NSMakeRect(0, 50, 500, 150)];
NSSize contentSize = [scrollview contentSize];
[scrollview setBorderType:NSGrooveBorder];
[scrollview setHasVerticalScroller:YES];
[scrollview setHasHorizontalScroller:NO];
chatView = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0,
contentSize.width, contentSize.height)];
[chatView setVerticallyResizable:YES];
[chatView setHorizontallyResizable:NO];
[chatView setAutoresizingMask:NSViewWidthSizable];
chat=[[NSString alloc] init];
[chatView setMinSize:NSMakeSize(0.0, contentSize.height)];
[chatView setMaxSize:NSMakeSize(1e7, 1e7)];
[chatView setDrawsBackground:TRUE];
[chatView setBackgroundColor:[NSColor whiteColor]];
[chatView setEditable:TRUE];
[chatView setRichText:TRUE];
[chatView setSelectable:TRUE];
[[chatView textContainer] setContainerSize:contentSize];
[[chatView textContainer] setWidthTracksTextView:YES];
[scrollview setDocumentView:chatView];
[self addSubview: scrollview];
when this did not work right, I returned to the site I was using:
http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ProgrammingTopics/
TextUILayer/Tasks/TextInScrollView.html and copied the code word for
word yet still had the same problem.
Thank you for any and all help,
Daniel Delp
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >openDocument (From: Carla Lewis <email@hidden>) |