• 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: NSTextView and Line Numbering
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView and Line Numbering


  • Subject: Re: NSTextView and Line Numbering
  • From: James Derry <email@hidden>
  • Date: Fri, 28 Feb 2003 17:34:33 -0500

Thanks Koen.

I finally ended up pretty-much ripping off the code you provided for me
originally, and writing a whole new subclass of NSView that hand-builds the
NSTextView pieces, but with a "private" NSView subclass to the left for
displaying line numbers. It's not the most elegant of solutions,
unfortunately, because it doesn't behave like a "real" NSTextView in I.B.,
but I've exposed enough that it gets me by. It's not too bad, really.

I'll post a link for a source code and a demo in a few days when I separate
it from my project.

In any case, thank you SO MUCH for your help -- I wouldn't have it at all if
not for the help!

Sincerely,
Jim Derry


On 2/25/03 8:04 PM, "Koen van der Drift" <email@hidden> wrote:

> At 1:36 PM -0500 2/23/03, James Derry wrote:
>
>> So, as long I DON'T mess with the original wrapping/sizing behavior of the
>> NSTextView, your routines worked perfectly for me. Using the setWordWrapping
>> I implemented above causes your routines to behave strangely for me.
>>
>
> Hi James,
>
> Just for comparison, here's how I set up my textview:
>
> -(id)initWithFrame:(NSRect)frame
> {
> if (self = [super initWithFrame:frame])
> {
> NSSize contentSize;
> IDViewContainer *myContainer;
>
> contentSize = [[self enclosingScrollView] contentSize];
> frame = NSMakeRect(0, 0, contentSize.width, contentSize.height);
> myContainer = [[IDViewContainer allocWithZone:[self zone]]
> initWithContainerSize:NSMakeSize(frame.size.width, 100000)];
>
> [myContainer setWidthTracksTextView:YES];
> [myContainer setHeightTracksTextView:NO];
>
> [self replaceTextContainer:myContainer];
>
> [myContainer release];
>
> [self setMinSize:frame.size];
> [self setMaxSize:NSMakeSize(100000, 100000)];
> [self setHorizontallyResizable:NO];
> [self setVerticallyResizable:YES];
> [self setAutoresizingMask:NSViewWidthSizable];
> [self setAllowsUndo:YES];
> [self setFont:[NSFont fontWithName: @"Courier" size: 14]];
>
> [[NSNotificationCenter defaultCenter] addObserver:self
> selector:@selector(windowDidUpdate:)
> name:NSWindowDidUpdateNotification object:[self
> window]];
> }
>
> return self;
> }
>
>
> So there are some differences with your setup that could explain the
> behaviour you're seeing.
>
>
> - Koen.
_______________________________________________
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: NSTextView and Line Numbering (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: [Newbie] writing plain text to a file
  • Next by Date: Re: [Newbie] writing plain text to a file
  • Previous by thread: Re: NSTextView and Line Numbering
  • Next by thread: nsformatters and focus
  • Index(es):
    • Date
    • Thread