Monday, January 9, 2012

Manipulating objects

The purpose of this screencast is to learn basic tools of Pharo to manipulate objects in a fun way.

(Pardon my English. Thanks to tell me what's wrong so I can improve).



Load package MorphExamplesAndDemos:
Gofer it
 squeaksource: 'PharoNonCorePackages';
 package: 'MorphExamplesAndDemos';
 load.

Open a new BouncingAtomsMorph in World:
BouncingAtomsMorph new openInWorld.

or in a window:
BouncingAtomsMorph new openInWindow.

Inspect the first BouncingAtomsMorph instance:
BouncingAtomsMorph allInstances first inspect.

Change the first BouncingAtomsMorph color to red:
BouncingAtomsMorph allInstances first color: Color red.

Stop then start BouncingAtomsMorph animation:
BouncingAtomsMorph allInstances first stopStepping.
BouncingAtomsMorph allInstances first startStepping.

Remove all submorphs of last BouncingAtomsMorph instance:
BouncingAtomsMorph allInstances last removeAllMorphs.

Move the first submorph of first BouncingAtomsMorph instance to last one:
BouncingAtomsMorph allInstances last 
  addMorph: BouncingAtomsMorph allInstances first submorphs first .

Delete all BouncingAtomsMorph instances:
BouncingAtomsMorph allInstances do: [:aMorph| aMorph delete].

Run the garbage collector:
Smalltalk garbageCollect.

9 comments:

  1. Amazing tutorial, I dont care about your english I care only that you show me all those marvelous things. Keep them coming , really useful and really necessary for every begineer.

    ReplyDelete
  2. I found this video to be very helpful, thank you! If it is possible, please use a slightly larger font. It can be tough to follow along with the videos because much of the text can only be seen when the video is in full screen. That, or using a lower screen res so everything appears larger. Regardless, thanks again.

    ReplyDelete
  3. Laurent, thank you for these tutorials! They are really useful. I have noticed that recent versions of the MorphExamplesAndDemos package from squeaksource/PharoNonCorePackages complains under Pharo 2. StickyPadMorph throws a doesNotUnderstand on registerInFlapsRegistry. Do you know how I can fix that?

    ReplyDelete
    Replies
    1. OK. I think I got it. The package from Damien Cassou had actually the version without flaps registry and didn't throw an exception.

      Delete
  4. Really nice tutorial!! Very impressive, thanks for all (I have to try Smalltalk).

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete