Example for the dropEnabled property (Morphic)
Last updated at 1:51 pm UTC on 7 January 2017
The following instructions demonstrate how the per-instance setting of the #dropEnabled property of a Morph instance works.
1. Create a simple RectangleMorph on screen (Use World->objects to open the ObjectsMorph viewer and drag out a RectangleMorph)
2. Use the halo to stretch the morph instance out a bit.
3. Use the Objects viewer to drag a EllipseMorph onto the screen.
4. Now just drag it over the rectangle and drop it. If you use the halo to open an explorer you can see that there are no submorphs in the RectangleMorph. This means the circle morph instance is not linked to the rectangle morph. It just happens that it is positioned over it.
5. Dragging the rectangle around the screen will leave the circle in its place on-screen.
Steps with dropEnabled
7. To drop the circle into the rectangle, use the halo to get the red menu and click on ‘accept drops.
8. This time when you drag the circle over the rectangle and drop it, it will get embedded.
- Dragging the rectangle around the screen will keep the circle in its place.
- Use the halo to open an explorer you can see that the circle is now a submorph in the rectangle.
- Dragging the rectangle will pull the circle along with it.
Drag and Drop Explained