Locking layering?

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Mon Jan 17 11:12:28 UTC 2000


Bob Arning wrote:

> Mark,
> 
> I think #beSticky is what you want. That way the SketchMorph cannot be picked
> up.

I might be off, but it seems you want to build hierarchical morphs. If you'd
make the text morph a submorph of the sketch, picking up the sketch would
also pick up the text morphs and other submorphs of it. This is completely
recursively nestable. To allow some morph to accept dropped morphs as
submorphs, you must give it the property of accepting drag and drop. (A less
nice way than d'n'd is to just place it visually on top of the morph you
want to add it to, and then do "embed..." on it from the menu.) I think the
Morphic designers meant that you should use pasteup morphs for composing
other morphs on, and that's why d'n'd isn't on for other morphs, but I never
use pasteups myself either, heh:

Add this somewhere in Morph>>addCustomMenuItems:hand: for convenience:

(self valueOfProperty: #openToDragAndDrop) == true
        ifTrue:
            [aCustomMenu add: 'disable drag and drop' action:
#toggleDragAndDrop]
        ifFalse:
            [aCustomMenu add: 'enable drag and drop' action:
#toggleDragAndDrop].

Now you can try dropping a rectangle on an ellipse and then drag around the
ellipse, etc.


Then, like Bob wrote, you use beSticky on a submorph to make it "stick" to
its owner morph, ie. be non-removable by dragging. However, this doesn't
work for your case unless the text really is a submorph of the sketch.


The "lock" message otoh makes a submorph "inacessible", ie. non-responsive
to dragging but also to just about everything else except being displayed
(ie. doesn't appear in submorphs menu, etc.)

Another more mundane feature is to use "go behind" to change the layering of
morphs (that are not composed as submorphs of each other), eg. when your
sketch covers everything beneath. However, submorph embedding into your
background is the way to go, and stickiness (also available in the menu) is
the best way to keep things in place.

Hope this helps,
Henrik

PS. you're demoing, right? Translucent menus became popular a week ago with
Apple's cheezy "Aqua". Try inspecting the Parameters class var of the
Preferences class, and set menuColor to eg. "Color white alpha: 0.9" (or 0.8
for less subtle effect). Translucent Blob colors (with gradients even!) look
cool too, passing over windows etc.; especially when they pass over each
other! (Err, make that "iBlob".)






More information about the Squeak-dev mailing list