[comp.lang.smalltalk] MVC question

peskin@caip.rutgers.edu (R. L. Peskin) (07/01/87)

An interesting? question comes up in the following MVC application:
Assume a model has two views. Normally model changes will register in
both views. If however, one of the view is covered by another (unrelated)
window, and the model continues to change, the uncovered view will update
in a normal manner. The covered view when uncovered will show a state
prior to changes before its covering. Any activation of the view, i.e.
move it, frame it, etc. will result in immediate update. This behavior
occurs on the Sun PS and Tektronix implementations, but not on the Xerox
1108 implementation. It appears that on the Sun and Tek versions, when a
view is covered, it is saved as of its last active state; and when re-exposed
it is not actually redrawn. Perhaps the Xerox implementation always redraws?

Does anyone have the correct explanation for this, and more important,
how to get around the problem? We are doing a full two and three dim.
general graphics utility in smalltalk, and need multiple views that behave
normally even when uncovered. We want to avoid implementation dependant
features.

--dick peskin 
  CAIP Parallel Computer Lab
  Rutgers University

  <peskin@caip.rutgers.edu>

allenw@tekchips.TEK.COM (Brock) (07/02/87)

In article <4282@caip.rutgers.edu>, peskin@caip.rutgers.edu (R. L. Peskin) writes:
>                      It appears that on the Sun and Tek versions, when a
> view is covered, it is saved as of its last active state; and when re-exposed
> it is not actually redrawn. Perhaps the Xerox implementation always redraws?
> 
> Does anyone have the correct explanation for this, and more important,
> how to get around the problem? We are doing a full two and three dim.
> general graphics utility in smalltalk, and need multiple views that behave
> normally even when uncovered. We want to avoid implementation dependant
> features.


You are correct, the Tektronix (and presumably PPS) images save the image
of a view when it is deactivated and use the saved image to redraw the
view when it is re-entered.  The 1108 image probably doesn't do this.

Under the Tektronix image this behavior can be totally disabled by
executing the expression:
	Smalltalk saveSpace: true.

or it may be selectively disabled on a per view type basis by
over-riding either of the following methods:
	StandardSystemView>>saveDisplayForm
	StandardSystemView>>validDisplayForm

This would be done by making the top level view of you editor
a subclass of StandardSystemView which redefines either or
both the these methods.

saveDisplayForm is the method which actually saves the image
of what is currently on the screen.  If this method does nothing
then the view will always be completely regenerated when ever
it is reactivated.

validDisplayForm returns true is there is a valid saved image
of the view (usually meaning that saveDisplayForm has done its
job).  It could be redefined to also check to see if the view
has been updated since the last time saveDisplayForm was executed.


PPS' version presumably has similar but probably different methods.
You could probably define you class so that it over-rode both
the Tek methods and the corresponding PPS methods.

	Allen Wirfs-Brock
	Tektronix Inc.
	allenw@spt.Tek.com

kentb@apple.UUCP (Kent Beck) (07/06/87)

> Question about saved forms being updated...

As I recall, if you give the StandardSystemViews of the two windows the same
model as the subviews, when the changed message goes out it invalidates
the cached form.

Kent Beck
Apple Computer, Inc.
20525 Mariani, MS 27E
Cupertino, CA 95014

uucp: kentb@apple.UUCP
csnet: kentb@apple.csnet

408/973-6027
-- 
Kent Beck
Apple Computer, Inc.
20525 Mariani, MS 27E
Cupertino, CA 95014

uucp: kentb@apple.UUCP
csnet: kentb@apple.csnet

408/973-6027