Connectors help needed

Ned Konz ned at squeakland.org
Sat Dec 25 05:45:56 UTC 2004


On Friday 24 December 2004 7:32 pm, Michael Latta wrote:
> This could be my code of course.  I have a subclass of
> NCConstraintMorph.  When I move the morph it is attached to it moves as 
> expected.  When I drag it it stays where I drop it, even if that is not
> where it is constrained to be.

When you drop it, it reconnects or disconnects depending on where you dropped 
it. This is how you reconnect Connectors and move labels.

> When I move the input object, it again 
> moves to where it should be.  Is there something I should be doing to
> make it truly constrained to the input object?

Sure. Just make it locked so it can't respond to user input.

> I can see the value in 
> letting it be away from the input during the drag, but when I let go of
> it in space, I want it to snap back to the input object.  When I let go
> over another object I want it to attach to that object.  The connector
> ends do something similar to what I want when they are dragged from one
> object to another, but they allow themselves to be dropped in empty
> space, which I do not want.  I will look at the connector end morph for
> a clue.

The connector end morphs don't respond to user input; all of the user input is 
grabbed by the connector. Which responds to clicks near its ends as requests 
to grab the end, so it disconnects the end and attaches it to the hand so you 
can drop it elsewhere.

So are you trying to replace the connector ends or are you trying to do 
something else with the NCConstraintMorph? It sounds like you don't really 
want them grabbable.

-- 
Ned Konz
http://bike-nomad.com/squeak/



More information about the Squeak-dev mailing list