[Newbies] a simple Morph

Stephan Janosch st.janosch at gmx.de
Thu Aug 7 13:13:40 UTC 2008

Hi there!

I have some difficulties to create a morph, which shows me simply all 
elements of an array inside that morph.

my morph has an instance var called myArray.

now the morph should simply show the contents of myArray.

and here my confusion start. I don't want to reprogram 
PluggableListMorph. But I don't get this thing to use myArray. I guess 
PluggableListMorph want's to have a model. Or?

So I should the MVC stuff, or?

I did some morphic tutorials, but none of these showed me, how to build 
a more complex morph. There are rectangles, drag and drop and so on.

But there is nothing like: here is a collection, now show me all 
elements of that collection inside a morph (as a list).

In my understanding, I would build a classic MVC-triple. But as i 
understood Morphic, there is no need for classic MVC anymore. So I am 
badly confused.

My realisation so far:

BorderedMorph subclass: #MenschMorph
	instanceVariableNames: 'liste'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'UserObjects'

	| c m|
	super initialize.
	self extent: 50 at 50.
	self position: 50 at 50.
	self color: Color white.
	self liste: #('name' 'alter' 'huhu').
	c  := 1.
	liste  do:
		[:each |
			m := TextMorph new openInWorld.
			m position: self position + (1 at c*10).
			c:= c+1.
			self addMorph: m.

Now i would write some manipulation stuff for 'liste'. I would delete 
all the TextMorphs and simply redraw them, but with my manipulated list 
as new 'input'.

And that feels damn wrong to me. How to proceed?

My goal should be a Morph, which shows me simply the contens of a list. 
The Morph should update itself, when i manipulate the list. Classic MVC 
for me. Am I right?

So long,

More information about the Beginners mailing list