Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Connectors
Last updated at 5:02 am UTC on 27 June 2018
Connectors is a package by Ned Konz that turns Morphic into a drawing environment for making connected drawings.

Uploaded Image: C2.jpg


The package also comes with several goodies that improve the drawing environment, including:

Load the package through SqueakMap (head version).

After loading the connectors package execute

     ConnectorsInfo createConnectorsFlaps

to get a flap for creating connectors.

You can also generate connections programmatically.

 | green red |

 green := Morph new
          color: Color green;
          position: 100@200;
          openInWorld.


 red :=   Morph new
          color: Color red;
          position: 100@300;
          openInWorld.

 NCAAConnectorMorph new
          connectStartTo: green ;
          connectFinishTo: red ;
          openInWorld

You can as well query the connections of a Connector or a Morph


TODO: add small example here ...


Some interactive documentation can be found in this project (2004)
ConnectorsMS-nk.pr and works for example in a squeak 3.6 or 3.7 image.
ConnectorsMS-nk.pr_active_essay_in_Squeak3.png

Screen copies here of it here: http://squeak.pbwiki.com/Connector%20Tutorial

This project has been ported to Squeak 4.x by Chris Muller, and the updated code is available at SqueakSource

Current and old versions are available at SqueakMap!

Connectors 2 has added:





Notes

In a 2006 paper about Etoys, Markus Gaelli et al use Connectors to implement a game, PetitPetri.

Download of the paper:
http://scg.unibe.ch/archive/papers/Gael06aC5.pdf

Connectors is compared with HotDraw: "connectors and their connected elements can be programmed directly: Whereas in Hotdraw one usually duplicates the topology of some graph by representing the graph both graphically and as a model, connectors invite the developer to directly manipulate the nodes and edges. Connectors e.g., provide expressions to send some messages to all incoming or to all outgoing nodes."

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:
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  


Different types of decoration are possible in Connectors 2:

Uploaded Image: Ends.jpg