Connectors
Last updated at 6:40 pm UTC on 10 March 2007
Connectors is a package by Ned Konz that turns Morphic into a drawing environment for making connected drawings.
A Connector (NCConnectorMorph) is a Morph that looks like a line and has a constraint on either end that keeps the ends attached to some other Morph (usually). Connectors work with any Morph.
The package also comes with several goodies that improve the drawing environment, including:
- Smart labels that position themselves to stay out of the way of whatever they're attached to
- Maker Buttons that save prototypes of Morphs and generate copies of them when pressed
- A button bar that holds Maker Buttons
- A tool to adjust the attachment points on a Morph
- Several other shapes that share a common yellow-button context menu
You can query the connections of a Connector or a Morph, and can generate connections programmatically.
Some interactive documentation can be found in this project (a few years old)
ConnectorsMS-nk.pr and works for example in a squeak3.6 image.
Here is a great tutorial: http://squeak.pbwiki.com/Connector%20Tutorial
Get the newest version from SqueakMap!
Connectors 2 has added:
- Antialiased drawing
- Borders
- Bitmap and gradient fills
- Bezier curves replace the cubic splines
- Vertex management (drag an end and the other vertices get moved appropriately)
- Auto-straightening on disconnection (optional)
- EToy scripting support
- Arrows can be arbitrary TrueType glyphs
- Better integration with Genie
- More configurable for your own applications
Here's some pictures of what is possible with Connectors 2 as far as decoration:


Question February 20, 2004 Hans Baveco: I am trying to adapt Connectors (1.9) to my needs - connecting only morphs of a certain class. I found out how to connect correctly when creating a new connector (an instance of a subclass of NCConnectorMorph I defined). However, how to proceed when disconnecting and reconnecting an existing morph? I want the blue handles to appear only on morphs that are allowed to be connected by my connector and can't figure out how to do this (currently the morphs in my application don't even show these handles, so one question is what determines whether the handles appear? I may have overridden some mouse event code or...?).
I guess the general question is "can one make connectors choosy?": with handles that show up only on the preferred morphs and only these preferred morph being connectable?
Answer Ned Konz Which handles do you mean? There are two things that I can think of:
- The curve vertex handles on the Connectors themselves, which can be turned on from the menu or a shift-click, and
- The connection highlighting that appears on potential connection destinations when you're dragging a Connector end. These show the potential attachment points on the morph.
I suspect you're talking about the second one. What you need to look at is:
Morph>>wantsAttachmentFromEnd: index ofConnector: aConnector
and
NCConnectorMorph>>wantsToAttachEnd: index toMorph: aMorph
NCConnectorMorph>>wantsToDetachEnd: index fromMorph: aMorph