[Q][Connectors] real detach?

German Morales germanmorales at delta-sys.com
Mon Jun 30 04:10:44 UTC 2003


Hi and thanks for the answer,

It seems that Ned Konz wrote:
>> 1. When executing the #disconnectedFromBy: method, the query
>> incomingConnections still returns the parameter aConnector as a
>> result, which is at least unexpected for me, since i'm receiving a
>> notification of disconnection.
>
> I could change the ordering of this. But for now you can just do:
>
> disconnectedFromBy: aConnector
> (self incomingConnections copyWithout: aConnector)
>   isEmpty ifTrue: self delete ].

Yes, I did it before to continue trying... but wanted to announce the
"anomaly".

>> 2. in the case of disconnetion by means of dragging,
>> #disconnectedFromBy: is called when I START dragging the connector
>> end, not in the moment of the drop in another morph or the World. I
>> understand that this is somehow correct since there is a
>> disconnection, but there is the posibility that people were just
>> dragging to better position the connector, and if in that moment I
>> remove the target morph from the world the reconnection will be
>> impossible. I want to know when a connection is confirmed to be
>> disconnected (drop somewhere but not in the previous morph). Is
>> that possible?
>
> Sure. You can subclass NCConnectorMorph (you probably want to do this
> anyway if you have any special behavior in your connectors), and then
> signal events on connection and disconnection, or otherwise notify
> interested parties.
>
> So on disconnection, your morph would wait around until it heard from
> the connector that it had been reconnected or deleted.

Ok, I've it running now.
I've overriden the #connectionsChanged method, which works but makes me
feel unhappy, since I must test if self destinationMorph gives me a nil or
not. Is that the best place to detect disconnections?

Greetings,

German Morales





More information about the Squeak-dev mailing list