FROM : Koen van der Drift
DATE : Sun Jan 26 21:37:10 2003
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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Sun Jan 26 21:37:10 2003
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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Koen van der Drift | Jan 25, 17:24 | |
| Koen van der Drift | Jan 25, 22:43 | |
| Koen van der Drift | Jan 26, 21:37 |






Cocoa mail archive

