• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to use a subclass of NSTextView inside a NSScrollView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: How to use a subclass of NSTextView inside a NSScrollView? (From: Peter Horn <email@hidden>)

  • Prev by Date: An update and more questions
  • Next by Date: Custom View loops in sendEvent
  • Previous by thread: Re: How to use a subclass of NSTextView inside a NSScrollView?
  • Next by thread: Screen Savers and OpenGL
  • Index(es):
    • Date
    • Thread