• 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: Struggling with NSTextView in a custom view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Struggling with NSTextView in a custom view


  • Subject: Re: Struggling with NSTextView in a custom view
  • From: Koen van der Drift <email@hidden>
  • Date: Sun, 26 Jan 2003 15:37:10 -0500

Hi,

I almost got my custom view working now. There is one thing that I don't
understand yet. My custom view has an NSScrollView in which I have an
NSTextView plus an NSView for a left margin (for linenumbers). I do the
following:

// create a frame for the left margin
frame.origin = NSMakePoint(0, 0);
frame.size = [scrollView contentSize];
frame.size.width = left_margin_width;

margin = [[NSView alloc] initWithFrame:frame];
[scrollView addSubview:margin];

// create a frame for the text view
frame.origin = NSMakePoint(left_margin_width, 0);
frame.size = [scrollView contentSize];
frame.size.width -= left_margin_width;

// make the text view and add it to the scrollview
textView = [[NSTextView alloc] initWithFrame:frame];
[scrollView setDocumentView:textView];


The problem is that the textView always starts at the left side of the
scrollview, instead of at left_margin_width. This is because I use
setDocumentView instead of addSubview. If I use the latter, then the margin
and the text are positioned ok, but the scroller doesn't respond to changes
in the textview.

How can I solve this?


thanks,

- 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.

  • Prev by Date: Re: FSSpec from NSString Problems
  • Next by Date: Re: FSSpec from NSString Problems
  • Previous by thread: Re: Struggling with NSTextView in a custom view
  • Next by thread: Faster scrolling of images
  • Index(es):
    • Date
    • Thread