Yes! Point me to those documents and I will love to read them!!! thanks in advance *Lic. Ignacio Sniechowski, MBA* *Prosavic SRL* *Tel: (011) 4542-6714* On Thu, Feb 5, 2015 at 1:02 PM, Trygve Reenskaug [via Smalltalk] < ml-node+s1294792n4804005h48@n4.nabble.com> wrote:
Because your drawOn: method doesn't draw anything and needs help from super. It seems to me that you need to read more documentation :-)
On 05.02.2015 15:53, nacho wrote:
That work perfectly. What a silly mistake!!! Of course it should have been position := aPoint. Now, is it possible write the drawOn: method without calling super drawOn: a Canvas? I don't completely get it why I should call super drawOn: aCanvas thanks nacho
*Lic. Ignacio Sniechowski, MBA* *Prosavic SRL*
*Tel: (011) 4542-6714*
On Thu, Feb 5, 2015 at 11:28 AM, Trygve Reenskaug [via Smalltalk] <[hidden email] <http:///user/SendEmail.jtp?type=node&node=4803979&i=0>> wrote:
I've tested your code in Squeak and found another bug (I should have been more careful when I read your code. Shame on me.)
In class Ball you have the methods
position: aPoint super position: aPoint. This does not set a value to your position variable in class Ball, but actually sets the upper-left corner of the bounds. You should have said position := aPoint. -------------------------------- The following now works in mySqueak image: EllipseMorph subclass: #Ball instanceVariableNames: 'position' classVariableNames: '' poolDictionaries: '' "this part is needed in Squeak" category: 'ZZZtesting'
drawOn: aCanvas self borderWidth:10; borderColor: Color green. super drawOn: aCanvas.
position ^ position.
position: aPoint position := aPoint.
I then execute the following in a workspace | aBall | aBall := Ball new. aBall position: ( 10@10 ). aBall openInWorld.
and it seems to work. But closer scrutiny shows that it ignores your instance variable (position). when I move the ball around. The reason is that EllipseMorph is a superclass of your Ball and cannot possibly know about an instance variable (position) that is defined in the subclass (Ball).
I ignored Ball>position since the EllipseMorph doesn't use it:
EllipseMorph subclass: #Ball instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'ZZZtesting'
position ^ super position.
position: aPoint super position: aPoint. This looks better. I you really want to replace the EllipseMorph>position you must go deeper into how the EllipseMorph handles its position and bounds . This will not be trivial. Much easier to invent a new instance variable and use it in the drawOn: method.
Good luck with your apprenticeship
On 05.02.2015 11:56, nacho wrote:
@Trygve I've checked and it doesn't work. I can't even bring the halo on to delete the morph. The debugger keeps popping. Thanks anyway to all Nacho
----- Nacho Smalltalker apprentice. Buenos Aires, Argentina. -- View this message in context: http://forum.world.st/Question-on-Morphic-drawOn-method-tp4803695p4803895.ht... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
--
*The essence of object orientation is that objects collaborate to achieve a goal. * Trygve Reenskaug [hidden email] <http:///user/SendEmail.jtp?type=node&node=4803964&i=0> Morgedalsvn. 5A http://folk.uio.no/trygver/ N-0378 Oslo http://fullOO.info Norway Tel: (+47) 22 49 57 27
------------------------------ If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Question-on-Morphic-drawOn-method-tp4803695p4803964.ht... To unsubscribe from Question on Morphic drawOn: method., click here. NAML <http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant...>
Nacho Smalltalker apprentice. Buenos Aires, Argentina.
------------------------------ View this message in context: Re: Question on Morphic drawOn: method. <http://forum.world.st/Question-on-Morphic-drawOn-method-tp4803695p4803979.ht...> Sent from the Pharo Smalltalk Users mailing list archive <http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> at Nabble.com.
--
*The essence of object orientation is that objects collaborate to achieve a goal. * Trygve Reenskaug [hidden email] <http:///user/SendEmail.jtp?type=node&node=4804005&i=0> Morgedalsvn. 5A http://folk.uio.no/trygver/ N-0378 Oslo http://fullOO.info Norway Tel: (+47) 22 49 57 27
------------------------------ If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Question-on-Morphic-drawOn-method-tp4803695p4804005.ht... To unsubscribe from Question on Morphic drawOn: method., click here <http://forum.world.st/template/NamlServlet.jtp?macro=unsubscribe_by_code&nod...> . NAML <http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant...>
----- Nacho Smalltalker apprentice. Buenos Aires, Argentina. -- View this message in context: http://forum.world.st/Question-on-Morphic-drawOn-method-tp4803695p4804006.ht... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.