Re: How to use a subclass of NSTextView inside a NSScrollView?
Re: How to use a subclass of NSTextView inside a NSScrollView?
- Subject: Re: How to use a subclass of NSTextView inside a NSScrollView?
- From: Matt Gemmell <email@hidden>
- Date: Tue, 19 Mar 2002 23:31:34 +0000
On 19/3/02 9:56 pm, Peter Horn <email@hidden> wrote:
>
> I think you might need to enlighten IB about the existence of your
>
> class. Choose Classes -> Read Files to make it parse your header.
>
>
Rather not. I created it in IB, so IB knows about. The trouble
>
seems to be that the NSTextView is inside an NSClipView inside an
>
NSScrollView...
>
>
I still don't get this done ... Any suggestions? I think it is a
>
pretty standard problem...
You could swap in a CMNotebookTextView instance as the documentView of the
NSScrollView at an appropriate time (like in windowControllerDidLoadNib, for
a document based app). You'd do something like this:
// scrollView is an outlet to the NSScrollView you want to put your view in
// textView is an outlet to the NSTextView in scrollView (created in IB)
NSSize contSize = [scrollView contentSize];
textView = [[CMNotebookTextView alloc]
initWithFrame:NSMakeRect(0, 0 contSize.width, contSize.height)];
// set attributes of the CMNotebookTextView programmatically here
[scrollView setDocumentView:textView]; // swap in your CMNotebookTextView
[textView release]; // since it's retained by the scrollView
Best,
-Matt
--
Matt Gemmell
Scotland Software
<
http://www.scotlandsoftware.com/>
_______________________________________________
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.