Login  Register

Re: Question on Morphic drawOn: method.

Posted by Ricardo Moran on Feb 04, 2015; 7:22pm
URL: https://forum.world.st/Question-on-Morphic-drawOn-method-tp4803695p4803729.html

Hi Nacho, 

The red box with two crossing yellow lines indicates that you made a mistake in the drawOn: method.
Whenever that happens, here is a tip that might help you. If you can't easily spot your error, you can debug it by evaluating:

aBall drawOn: Display getCanvas.

This will bring up the debugger and hopefully give you more information.

Best regards,
Richo

On Wed, Feb 4, 2015 at 3:00 PM, nacho <[hidden email]> wrote:
Hi,
I have the following question:
I want to draw a bouncing ball.
First thing I do is create a class:

EllipseMorph subclass: #Ball
        instanceVariableNames: 'position'
        classVariableNames: ''
        category: 'PBE-BouncingBall'


Then an initialization method that mostly do a super initialize.
Then the drawOn:

drawOn: aCanvas
        aCanvas borderWidth:10; borderColor: Color green.


And finally a position method:

position: aPoint
        super position: aPoint.

position
        ^ position.


Finally in a Playground I do:

| aBall |

aBall := Ball new.
aBall position: ( 10@10 ).
aBall openInWorld.

But I get a red box with two crossing yellow lines.
What I'm missing?

Thanks in advance.
Nacho




-----
Nacho
Smalltalker apprentice.
Buenos Aires, Argentina.
--
View this message in context: http://forum.world.st/Question-on-Morphic-drawOn-method-tp4803695.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.