Handling events on NCAAConnectorMorph subclass

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Handling events on NCAAConnectorMorph subclass

Nicola Mingotti
Hi,

I am using package Connectors.

I made my own connectors subclassing NCAAConnectorMorph [say it is called MyCon] 

Now, I would like the aMyCon to change its color to black when it is connected to other 2 morphs and be orange when it is not fully connected.

I saw there is NCAAEventsHandler with stateConnected and stateDisconnected but I don't understand how i can use these two events.

I tried defining inside the class MyCon methods like these, copying what I do for mouse events:
------------
handlesStateConnected: evt
  ^ true

stateConnected: evt
    self color: Color black
------------

It does not work.

How should I do ? I don't find an example.


Are NCAAEventsHandler
events recognized by NCAAConnectorMorph ?

I would like my event handler to add up to what the default event handler does, not substituting it.

bye
Nicola













_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Handling events on NCAAConnectorMorph subclass

Nicola Mingotti

Never mind, I guess i found the methods I was looking for:
enterConnected
exitDraggingEnd

bye
Nicola




On 7/13/19 7:03 PM, Nicola Mingotti wrote:
Hi,

I am using package Connectors.

I made my own connectors subclassing NCAAConnectorMorph [say it is called MyCon] 

Now, I would like the aMyCon to change its color to black when it is connected to other 2 morphs and be orange when it is not fully connected.

I saw there is NCAAEventsHandler with stateConnected and stateDisconnected but I don't understand how i can use these two events.

I tried defining inside the class MyCon methods like these, copying what I do for mouse events:
------------
handlesStateConnected: evt
  ^ true

stateConnected: evt
    self color: Color black
------------

It does not work.

How should I do ? I don't find an example.


Are NCAAEventsHandler
events recognized by NCAAConnectorMorph ?

I would like my event handler to add up to what the default event handler does, not substituting it.

bye
Nicola














_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners