• 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: NSScrollView / NSTextView questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSScrollView / NSTextView questions


  • Subject: Re: NSScrollView / NSTextView questions
  • From: Josh Black <email@hidden>
  • Date: Tue, 20 Apr 2004 08:43:02 -0700 (PDT)

I tried implementing your idea (b) last night, with some success. I
have a custom view that is the superview of 2 NSTextViews. I made that
the documentView of my NSScrollView. Everything gets drawn in the
right place, right size, etc. The problem I'm having is that I can not
get the focus of the primary NSTextView. I have a method in my custom
view that returns a reference to the primay text view which I set like
this (lineView is my custom view).

NSTextView *textView = [lineView textView];

Then I have these lines:

[[self window] makeFirstResponder:textView];
[[self window] setInitialFirstResponder:textView];

But I still can not get textView to accept the focus. Any ideas on
what I'm doing wrong? Thanks for the help so far!

Josh

--- Douglas Davidson <email@hidden> wrote:
> On Apr 19, 2004, at 11:55 AM, Josh Black wrote:
>
> > I looked at the document nib file for SubEthaEdit and I can see
> that
> > they have a NSScrollView for the entire editing region. How does
> one
> > achieve the kind of line numbering effect that they have? Do I
> need to
> > create a custom view that has a NSTextField for the line numbers
> and
> > place that next to the NSTextView, then make that custom view the
> > document view of the NSScrollView? Or is there a better way to do
> > this? Can I create a nice clean separation like they have using
> only
> > the NSTextView? I've seen a few line numbering implementations
> that
> > draw the line numbers inside the NSTextView itself, but there was
> no
> > separation. The numbers appeared next to the text with a small
> gap,
> > but (IMHO) it looks a bit sloppy without a nice column to put the
> line
> > numbers in.
>
> You can (a) subclass NSTextView and draw the line numbers yourself in
>
> addition to the standard drawing or (b) use an additional custom
> view,
> place it in the scrollview and place your text view in it as a
> subview.
> In case (a) you may wish to manipulate the text view's
> textContainerInset and/or the text container's lineFragmentPadding.
> For case (b) you may wish to refer to the TextEdit sample code, which
>
> uses a superview for the text views in the multiple-page case.
>
> Douglas Davidson
> _______________________________________________
> 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.
_______________________________________________
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: NSScrollView / NSTextView questions (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Monitoring a folder?
  • Next by Date: Re: Monitoring a folder?
  • Previous by thread: Re: NSScrollView / NSTextView questions
  • Next by thread: Re: NSScrollView / NSTextView questions
  • Index(es):
    • Date
    • Thread