Re: NSTextView without NSScrollView?
Re: NSTextView without NSScrollView?
- Subject: Re: NSTextView without NSScrollView?
- From: John Hörnkvist <email@hidden>
- Date: Sat, 5 May 2001 03:21:40 +0200
On Friday, May 4, 2001, at 07:56 PM, Dan Wood wrote:
Is there any way in Interface Builder to create an NSTextView *without*
an associated NSScrollView? There seems to be no way to detach it from
the scroll view. (I want to have an NSTextView, not an NSTextField, so
I can populate it with an HTML <a> tag and make use of the textView:
clickedOnLink: atIndex: delegate method so I can respond to a click.)
You can always remove it from the scroll view when the nib has been
loaded.
That is, do something like:
- (void)awakeFromNib
{
NSView* mainView=nil;
textView=[scrollView documentView];
[textView retain];
[textView removeFromSuperview];
// Set the frame of the text view to something reasonable here. I
think the scroll view's frame should be OK.
[textView setFrame:[scrollView frame]];
mainView =[scrollView superview];
[scrollView removeFromSuperview];
[mainView addSubview:textView];
[textView release];
}
Untested code; use at your own risk.
Regards,
John Hornkvist