Flipping through Andy Burnett’s blog Learning Smalltalk he discusses in Getting a handle on objects from the Flaps how to get programmatic reference to morphs that have been created by direct manipulation – for example by being dragged on-screen from the tool flaps. The “textual reference to dropped morph in Workspaces” looked like an interesting feature that would likely to be quite useful in the future – so best to find out how it works right now…
Although I had seen these flaps while previously playing around with Squeak 4.2, [Projects > New Project > New MorphicProject] now did not show any. The flaps needed to be enabled through [World menu > flaps > show shared flaps].
I then created a workspace [World > Workspace] and an object in the world [Objects flap > Categories > Graphics > Curve > drag onto world ].
First the default behaviour was tested by dragging Curve over the Workspace. As expected it did nothing. Curve was dragged away from Workspace.
Instead Curve became stuck to Workspace such that dragging Curve also dragged Workspace with it. Curve had to be removed from Workspace using [Curve > Halos > Pick Up]. Then [Halos > Menu > accept drops] was disabled.
Further exploration found another related menu, marked “2” above. This did have the required menu option. After enabling [create textual references to dropped morphs], Curve was dropped onto Workspace. This now created the text “curve2970” in Workspace. Then [curve2970 > inspect it] displayed an identical inspector to that displayed for [original graphic object > Halos > Debug > Inspect It].
That is way cool. Are there any other programming environments that can do that out of the box?
I then found some additional info, which I’ll leave for further reading…
Squeak Wiki FAQ: How do I access a Morph from a Workspace?