debugging when:send:to: ?
Ned Konz
ned at bike-nomad.com
Wed Jul 9 14:00:46 UTC 2003
On Wednesday 09 July 2003 02:51 am, Ingo Hohmann wrote:
> On further investigation, I am opening a system window with my
> object as model. It seems that after the system window is closed,
> the actionMap is empty.
> Does closeBoxHit somehow send release to the model?
Yes. Look at #delete.
It says:
model windowIsClosing; release.
And, of course, release drops the actionMaps.
However, I think that it should be the model's choice whether to
release or not here (that models that care should probably call
release from #windowIsClosing, rather than having it forced on them
from the window).
Among other things, this prevents you from having multiple
SystemWindows on the same model.
As other people have commented, perhaps in Morphic the SystemWindows
should behave more like other Morphs.
Still, there's the compatibility with MVC to consider: most of the
models of the SystemWindows don't know or care that they're being
used in Morphic. And in MVC the window is more central, since it also
has the controller loop in it (with its ideas of focus, etc.)
But it's interesting to note that StandardSystemView (the MVC
equivalent of SystemWindow) in its #release method *doesn't* call
model release; it just says:
model windowIsClosing.
> Yes, I now nil'ed out the model before closing, and the actionMap
> stays intact.
>
> Are there better ways to close a SystemWindow?
You could hide them, or collapse them, or move them offscreen if you
wanted, but you're going to run into the same problem with the
#closeBoxHit.
If you have your own subclass of SystemWindow, you could override
#closeBoxHit and/or #delete to do what you want.
In my opinion, it should be possible to re-use SystemWindows (and
other Morphs) once they've been deleted.
> Is this a bug, or do I miss something? (I guess, only those
> messages should be released which have to do with the SystemWindow,
> not all messages.)
That's right.
I'd look at this as a bug.
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|