Ned Konz ned@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 ?
On Tuesday 30 April 2002 01:09 pm, Martin Drautzburg wrote:
Ned Konz ned@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.
On Tuesday 30 April 2002 01:09 pm, Martin Drautzburg wrote:
I wrote:
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 ?
You mean like in, say Windows? Sorry, I wasn't thinking of menu bars in windows, but of independent floating menus.
The easiest way is to realize that you have two different pieces: there's the menu button itself that pops up/down the menu, and the menu itself. They shouldn't be part of the same Morph.
Changing the size of the morph is a no-no in most window layouts.
So instead, you realize that the menu is a different thing, and is actually a separate Morph owned by the world. And its morphicLayerNumber is low enough to be on top of whatever it was raised for.
Your menu button then just shows or hides the actual menu, in the appropriate position.
squeak-dev@lists.squeakfoundation.org