[Q] Connectors
Ned Konz
ned at bike-nomad.com
Fri May 30 23:26:01 UTC 2003
diegogomezdeck at consultar.com wrote:
> First of all, I had not the oportunity to say it before:
>
> The Ned's connectors are great! Every Squeaker has to try them!
Thanks! Wait for the next version to appear soon...
> I have a couple of questions:
>
> 1) I found that the toBeConnected object can decide is it will be connected
> or not (with #isConnectable). My question is: Can the connector (aka
> theArrow) decide this? I need a connection between a pair of diferent type
> of objects (an out-in couple) and seems like the arrow is the candidate to
> decide this. I can move this decision to the toBeConnected object, but I
> prefer the other option.
Yes, this is (of course) something you want to do.
There is a method
NCConnectorMorph>>wantsToConnectEnd: index to: aMorph
that you can use to answer if something should be connected to. Index
will be 1 or 2.
It's common in my code to have this answer something like "aMorph
isWhateverShapeMorph".
And of course you could ask aMorph as well.
> 2) I have a morph (not connectable) with some connectable submorphs. The
> only way I found to do that is using a PasteUpMorph as the outer-
> nonConnectable container but I want to use other morph. How can I do that?
Use a PasteUpMorph as a submorph of your other morph to hold the
connectable submorphs. Look at the NCCompositeStateMorph classes. Or
change the logic that is used to find the targets (not recommended).
> 3) Sometimes the connectors moves behind the connected morphs. Is possible
> to force the connector to be the in-front of the connected morphs?
This shouldn't happen unless you're playing games with pasteupmorphs
that are pretending not to be themselves somehow. Are the morphs that
are in front of the connector living on the same paste up morph?
More information about the Squeak-dev
mailing list
|