[comp.sys.next] Help: IB and ScrollView

zazula@uazhe0.physics.arizona.edu (RALPH ZAZULA) (03/13/91)

This is a beginner question...

I'd like to have a TextObject in a ScrollView within a Window to display
text (eg. 100 lines of "hello world"). Is there an easy way to do this
with InterfaceBuilder?  I have the 1.0 'System Reference : Concepts'
manual and it has a good example on doing this manually (Ch 9 :The Text 
Class, page 35).  I've tried pulling a ScrollView into the window MyWindow
that IB gives me at startup.  I then saved everything, did a 'make' and
ran it.  Sure enough the ScrollView was there and working.  Now, how do 
I send text to it?  I want to do something like:

	[ScrollView setText:"here is some text"];

but I don't know the name of the IB provided ScrollView.  

Thanks,
Ralph



   |----------------------------------------------------------------------|
   | Ralph Zazula                               "Computer Addict!"        |
   | University of Arizona                 ---  Department of Physics     |
   |   UAZHEP::ZAZULA                            (DecNet/HEPNet)          |
   |   zazula@uazhe0.physics.arizona.edu         (Internet)               |
   |----------------------------------------------------------------------|
   |   "You can twist perceptions, reality won't budge."  - Neil Peart    |
   |----------------------------------------------------------------------|

liberte@ncsa.uiuc.edu (Daniel LaLiberte) (03/15/91)

> From: zazula@uazhe0.physics.arizona.edu (RALPH ZAZULA)
> I want to do something like:
> 
> 	[ScrollView setText:"here is some text"];
> 
> but I don't know the name of the IB provided ScrollView.  

I just figured this out yesterday.  It wasnt obvious from the
limited documentation.

First you have to create your own class by using the subclass item in
the Class window.  Which class it is a subclass of depends on what you
want to do with it.  

Then create an instance of your class and add an outlet in the Class
Inspector which will be used to name the scrollview (getting the right
display up for this can be a trick).

Then make a connection from this outlet by going to the connections
display, selecting the outlet and control dragging from your class
instance to the ScrollView.

Then unparse your class and edit the source to add methods that have
access to the ScrollView via your named outlet.  I havent figured out
when exactly the outlet is set to the object it is connected to.

Dan LaLiberte
National Center for Supercomputing Applications
liberte@ncsa.uiuc.edu