[Q][morphic] Collapsing menus. Was: how to hide submorphs

Ned Konz ned at bike-nomad.com
Tue Apr 30 20:35:15 UTC 2002


On Tuesday 30 April 2002 01:09 pm, Martin Drautzburg wrote:
> Ned Konz <ned at bike-nomad.com> writes:
> > I'd recommend not having visible submorphs outside your
> > fullBounds. Actually, I'd recommend not having submorphs at all
> > outside your fullBounds.
>
> So how would you collapse a menu ?

I described one way (draw it collapsed or draw the submorphs too, 
depending on state).

You could also remove the menu items (either remove the submorphs 
themselves and add them later, or just regenerate the submorphs).

If you look at Morph>>collapse, it replaces the Morph (in its owner's 
submorphs collection) with a CollapsedMorph that then points to the 
original. This is another way, and allows for any Morph to be simply 
collapsed (I'm not suggesting that you want this particular Morph, 
but the technique is simple.) Look at beReplacementFor: to find the 
replacement.

So you could have (for instance) a CollapsedMenuMorph that when 
clicked replaced itself with the saved full menu.

SketchMorph>>collapse does this too.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list