Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!nntp.sei.cmu.edu!cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!vixen.cso.uiuc.edu!sdd.hp.com!hplabs!hplextra!hplb!gw
From: gw@hplb.hpl.hp.com (Gunther Walther)
Subject: Re: Visualworks problem: How to draw into a View Holder
Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
Message-ID: <D9Jtq4.6IB@hplb.hpl.hp.com>
Date: Fri, 2 Jun 1995 14:03:39 GMT
References: <3qkk3l$e4u@mailer.york.ac.uk>
Nntp-Posting-Host: gwalther.hpl.hp.com
Organization: Hewlett-Packard Laboratories, Bristol, England
X-Newsreader: TIN [version 1.2 PL0.7]
Lines: 33

John 'john..' Tuffen (jat5@york.ac.uk) wrote:
: Well.....
: 	I'm a newcomer to VisualWorks (I've been using it for a week 
: now), and I want to be able to draw some lines into a View Holder. The 
: View Holder is a passive thing, requiring no controller interaction. How 
: do I do it? I've managed to draw things into a ScheduledWindow, but I 
: need a scrolling display (there's a lot of stuff to show!).

: I keep looking at the 'CustomView' example, but I can't see how to modify 
: it :(


When your application model is opened, it is asked to provide a view.
The method that is called in your ApplicationModel is the method
you specified as the aspect of the view holder.

YourView (likely a subclass of View) is created with a
YourView model: yourModel message. This also sets up a dependency
relationship between your model and the view.

Your view gets send a
"displayOn: aGraphicsContext" message.  In response to that message your
view then draws something on the GraphicsContext. Usually YourView goes
to its model to get some information about what it should draw.

In case your model changes, it should send a "self changed" message to
itself. By default, the view in its "update" method will send "self invalidate".
This then triggers a redraw of the view, e.g. some time later the view
will be send a "displayOn:" message.

I hope this helps,

gunther
