[comp.lang.smalltalk] 2 views on same model - a solution

MUHRTH@DB0TUI11.BITNET (Thomas Muhr) (12/15/89)

I desperately hope that this is the solution to a problem I stated 2 days
ago: How could one have two views on the same model in overlapping windows
and close one view without destroying ALL dependents between the model and
all views.
If it wasn_t for Brian LeClaire (thanks a lot) I would have shed a lot of
tears about it. Brian proposed an inverted release-method to accompany the
release method in Object: Not removing the model-entry from the dependents
list, which is a very, very crude approach, but remove the pane from the
dependency-list of the model, which is very subtle and seems to work:
With some minor modifications here is Brian's 'release':


!Object methods !

release: aPane
"      Autor: Th. Muhr
       Datum: Dec 15, 1989
       Modifiziert von Th. Muhr : Dec 15, 1989
Kommentar: Modifikation nach Brian LeClaire
"
|coll|
coll:= Dependents at:self ifAbsent:[^self].
coll  remove: aPane ifAbsent:[].
coll isEmpty ifTrue: [Dependents removeKey:self]! !

All (Pane)'calls' to release (only one) have to be modified to:
release       (in TopPane)
  model release:self.
  model:= nil.

This seems to work.
Good images to everyone and a happy new year-
 Thomas
-------
Thomas Muhr, Technical University of Berlin, BITNET: muhrth@db0tui11
   Project ATLAS - Computer Based Tools for Qualitative Research
         "Computers, like every technology, are a vehicle
      for the transformation of tradition." (WINOGRAD/FLORES)