[Q][Connectors] real detach?

German Morales germanmorales at delta-sys.com
Sun Jun 29 04:04:19 UTC 2003


Hi everyone!

I've some doubts about connectors.

I have 2 morphs connected with a nice NCConnectorMorph, and I'd like to
know when there is a REAL detach in order to remove the now disconnected
Morph from my world.

In other words, what I want to happen is:
 before:
   Morph1 -----> Morph2
   (Morph1 and Morph2 are connected)

 after case 1:
   Morph1
   (the connection was deleted (#delete), then M2 is not needed
   and removed)

 after case 2:
   Morph1 ----->
   (the connection is detached by means of dragging, then M2 is
   not needed and removed)


I first implemented #disconnectedFromBy: like this:
   disconnectedFromBy: aConnector
      (self incomingConnections) isEmpty ifTrue: [self delete]

But I'm facing some problems with this approach:
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.

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?


Any help will be greatly appreciated,
Thanks in advance,

German Morales





More information about the Squeak-dev mailing list