newbie question

j s arf_arf69 at yahoo.com
Fri Feb 28 19:09:31 UTC 2003


I am puzzled

MyListMorph is supposed to create and display a list 
morph with sample text in the list. 

this snippet works:

---------------------------------------------------
    (MyListMorph new initialize: self myMenu x: 10 y:
10)  openView.
---------------------------------------------------

    myMenu   "defined as a class method"
	^ #(choice1 choice2 choice3).
---------------------------------------------------
this snippet does not work:


---------------------------------------------------
    (MyListMorph new initialize: self myOtherMenu x:
10 y: 10) openView.
---------------------------------------------------

    myOtherMenu  "defined as an instance method"
	^ #(choice1 choice2 choice3).
---------------------------------------------------


and this one, of course, works:
---------------------------------------------------

	| w aa |

	w _	MyListMorph new.
	aa _	w myOtherMenu.
	w	 initialize:  aa  x: 800 y: 600.
	w	openView.
---------------------------------------------------


Why does the class method return the collection but 
the instance method does not.  Is the instance not 
created after the [new] message even before the 
[initialize:x:y:] message?
How would I write a single line command that works 
with an instance method?
I now that it is not good practice to run commands
together on a single line, makes code difficult to 
read, but I am trying to understand the workings of 
Squeak.

regards

js:)

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/



More information about the Squeak-dev mailing list