Re: Struggling with NSTextView in a custom view
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.