[Q] Connectors
Baveco, Hans
Hans.Baveco at wur.nl
Sat Feb 21 15:06:45 UTC 2004
Thanks Ned,
these are exactly the methods I need to take a look at (it just didn't occur to me to look at Morph, but of course, some connector methods must be located there as well).
Hans
On Friday 20 February 2004 2:07 pm, Baveco, Hans wrote:
> Hi, 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
> overriden 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?
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
--
Ned Konz
http://bike-nomad.com/squeak/
More information about the Squeak-dev
mailing list
|