Help - How to stop AlignmentMorphs aligning

Bob Arning arning at charm.net
Tue May 23 13:33:29 UTC 2000


Hi Russell,

On Tue, 23 May 2000 20:15:37 russell.allen at firebirdmedia.com wrote:
>Last week I posted a short changeset as an experiment in a new way of
>showing modal dialogs of the Yes/No/Cancel variety.   
>
>It was pointed out by Bert Freudenberg that it didn't work with
>BookMorphs, and I have been trying to fix the problem.
>
>What the code does is that it adds a new submorph to the morph which
>received the #confirm: message.  This new submorph positions itself so
>that it entirely covers the original morph (and thus blocking access
>it), and waits for one of the Yes/No/Cancel buttons to be pressed.
>
>However, BookMorphs are AlignmentMorphs, and when the new submorph is
>added it re-aligns all of the other submorphs, spoiling the affect.
>
>Is there any way to temporarily freeze an AlignmentMorph so that it
>stops dynamically re-aligning all its submorphs?  Or should I find
>another way to create a morph which covers the original morph?

Personally, I would try to avoid adding morphs to other morphs arbitrarily. In addition to the behavior of AlignmentMorphs in such cases, you don't know what other behavior some morph may have when a submorph is added. What I have done and had success with is:

When a completely modal dialog is required,
- Add to the front of the World a transparent morph (call it MouseCatcherMorph, e.g.) that covers the entire world.
- Arrange that MouseCatcherMorph handles mouse events and ignores them (or beeps or whatever) so that it cannot be picked up and moved.
- Add your dialog morph to the MouseCatcherMorph (positioned as you think appropriate).
- When the dialog morph is deleted, have it delete the MouseCatcherMorph as well.

Cheers,
Bob





More information about the Squeak-dev mailing list