[comp.sys.next] hint: scrolling text windows

mrc@Tomobiki-Cho.CAC.Washington.EDU (Mark Crispin) (02/23/89)

Suppose you want to have a scrolling text window in the application
you're building.  Well, IB makes that simple; you make a window, put a
scrolling text view inside of it, and make that view fill the window.
However, you'll discover that if you resize that window in your
application the view doesn't resize.

This is because the scrolling text view is a subview of the content
view and size changes aren't passed to subviews by default.  You can
either write the code to pass down the resizing by hand, or you can
make the scrolling text view be the content view.  Suppose you have a
socket from that scrolling text view (presumably because you want to
note it down someplace).  You might write the method for this socket
as something like:

- setmyText:anObject
{
  /* make it be the window's content view, so resizing the window
     resizes the view */
  [[anObject window] setContentView:anObject];
  myText = [anObject docView];	/* note its docView for use later */
  return self;			/* standard return */
}