ftp.nice.ch/pub/next/developer/objc/appkit/ScrollWindow.README

This is the README for ScrollWindow.tar.gz [Download] [Browse] [Up]

 Autoresizing is a very nice Appkit feature.  However, for some Views it just doesn't make sense to autoresize.  One day I was looking at the IB palette, and I noticed that it was completely resizable, but none of the interior elements changed.  When the palette window was smaller than a certain size, >BANG<, a scroller appeared.  I'm always low on screen space, so I loved it.
 ScrollWindow does just about the same thing.  If you're using IB, ScrollWindow is easy to use:
 1) make your IB Project recognize the ScrollWindow (subclass Window, Parse).
 2) change the desired window's class from Window to ScrollWindow.
 3) tell the ScrollWindow to becomeScrollWindow at some point in the initialization sequence (at appDidInit time works for me).
 Or, if you're not using IB, you should just [ScrollWindow new] or [ScrollWindow newContent:blah:blahblah...] and once you've filled the ScrollWindow with Views, tell it to becomeScrollWindow.

 You _can_ add more Views or do things to your ScrollWindow after you've told it to becomeScrollWindow, but the important thing to remember is that you shouldn't touch [someScrollWindow contentView]; rather, you should message [[someScrollWindow contentView] docView].  This is because becomeScrollWindow places the old contentView one level lower in the View heirarchy, under a newly-created ScrollView.

 Unfortunately, a ScrollWindow doesn't send the windowWillResize:toSize: or windowDidResize: messages to its delegate.  It is possible (and easy) to make ScrollWindow do this, but I think it would involve NXReponsibleDelegate() and I just didn't want the mess.

 A trivial, yet elegant, piece of code.  Enjoy.

 David S. Joerg
 MindShock, Inc.
 Internet : joerg@alliant.mcs.anl.gov

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.