This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-07-05 11:18:40

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Where is Scratch's init method?

Question for the Scratch Team (or Jens) or... anyone that does know. I don't know if this question has a sense in Squeak (I'm a real newbie at SmallTalk) but I guess that asking won't hurt anyone: is there a first method that is run when you select "open > Scratch" in the World menu of Squeak and that will setup the whole Scratch GUI? If so, under which class is it listed?

Offline

 

#2 2008-07-07 13:32:58

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Where is Scratch's init method?

What I like best about Squeak/Smalltalk is that you don't have to know much or memorize a lot, because you can browse/inspect anything and everything just about anywhere, it's a completely self-reflective and thus largely self-explanatory system. For instance, if you choose "keep this menu up" for the open-menu, and then right-click on the "open Scratch" entry, you can inspect what it does. This will eventually take you to the code which launches Scratch, something like

   ScratchFrameMorph new openInWorld;
      startup

You can now browse throughout these methods:

   "new" is inherited from class Object and calls "initialize" (that's where all the fun is).

   "openInWorld" is inherited from class Morph, nothing special there.

   "startup" is being called whenever the image starts up (if the receiver is registered to respond to it), this basically checks for command line parameters and other environment stuff.

(note: for Chirp I am using a different method, because I wrapped another container morph around the ScratchFrameMorph to add scroll bars to it, and to make it resizable, sort of like a Russian doll approach)


Jens Mönig

Offline

 

Board footer