Migrating old AlignementMorph code to TableLayout

Stephane Ducasse squeak-dev at lists.squeakfoundation.org
Mon Sep 30 20:40:32 UTC 2002


--Boundary_(ID_lheptP+NijCfFOH+XeTzxA)
Content-type: text/plain; charset=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT

Hi all

I stupidly played around with SameGame and naively copied the 
AlignmentMorph code ;(
Now I would like to use TableLayout and other new stuff (so that my 
book is not deprecated before been finished).
Is there any path to follow. I'm rading the project on MorphLayoutPolicy
Here is the code I have:

--Boundary_(ID_lheptP+NijCfFOH+XeTzxA)
Content-type: application/text; x-mac-creator=522A6368; x-unix-mode=0644;
 x-mac-type=54455854; name=BreakOut.st
Content-transfer-encoding: QUOTED-PRINTABLE
Content-disposition: attachment; filename=BreakOut.st

'From Squeak3.2gamma of 15 January 2002 [latest update: #4857] on 30 =
September 2002 at 10:40:09 pm'!=0DAlignmentMorph subclass: #BreakOut=
=0D=09instanceVariableNames: 'field scoreDisplay lifeDisplay '=0D=
=09classVariableNames: ''=0D=09poolDictionaries: ''=0D=09category: 'B=
reakout1'!=0D=0D!BreakOut methodsFor: 'initialize' stamp: 'sd 7/25/20=
02 22:40'!=0DbuildButton: aButton target: aTarget label: aLabel selec=
tor: aSelector=0D=09"wrap a button or switch in an alignmentMorph to =
allow a row of buttons to fill space"=0D=0D=09| a |=0D=09aButton =
=0D=09=09target: aTarget;=0D=09=09label: aLabel;=0D=09=09actionSelect=
or: aSelector;=0D=09=09borderColor: #raised;=0D=09=09borderWidth: 2;=
=0D=09=09color: color.=0D=09a :=3D AlignmentMorph newColumn=0D=09=
=09wrapCentering: #center; cellPositioning: #topCenter;=0D=09=09hResi=
zing: #spaceFill;=0D=09=09vResizing: #shrinkWrap;=0D=09=09color: colo=
r.=0D=09a addMorph: aButton.=0D=09^ a=0D=0D! !=0D=0D!BreakOut methods=
For: 'initialize' stamp: 'sd 8/1/2002 11:30'!=0DinitializeToStandAlon=
e=0D=0D=09super initializeToStandAlone. =0D=09self listDirection: #to=
pToBottom.=0D=09self wrapCentering: #center; cellPositioning: #topCen=
ter.=0D=09self vResizing: #shrinkWrap.=0D=09self hResizing: #shrinkWr=
ap.=0D=09self layoutInset: 3.=0D=09color :=3D Color red alpha: 0.3.=
=0D=09=0D=09field:=3D BreakoutField newStandAlone.=0D=09field addDep=
endent: self.=0D=09self addMorph: self makeControls.=0D=09self addMor=
ph: field.=0D=09self update: #lifes=0D=0D=09! !=0D=0D!BreakOut method=
sFor: 'initialize' stamp: 'sd 7/30/2002 18:35'!=0DmakeControls=0D=
=0D=09| row |=0D=09row _ AlignmentMorph newRow=0D=09=09=09color: colo=
r;=0D=09=09=09borderWidth: 0;=0D=09=09=09layoutInset: 3.=0D=09row =
=0D=09=09hResizing: #spaceFill; =0D=09=09vResizing: #shrinkWrap; =
=0D=09=09wrapCentering: #center; =0D=09=09cellPositioning: #leftCente=
r; =0D=09=09extent: 5 at 5.=0D=09row addMorph:=0D=09=09(self=0D=09=09=
=09buildButton: SimpleButtonMorph new=0D=09=09=09target: self=0D=09=
=09=09label: 'Quit'=0D=09=09=09selector: #delete).=0D=09row addMorph:=
=0D=09=09(self=0D=09=09=09buildButton: SimpleButtonMorph new=0D=09=
=09=09target:  field=0D=09=09=09label: 'New game'=0D=09=09=09selector=
: #newGame).=0D=09row addMorph:=0D=09=09(self=0D=09=09=09buildButton:=
 SimpleButtonMorph new=0D=09=09=09target:  field=0D=09=09=09label: 'P=
ause game'=0D=09=09=09selector: #pauseGame).=0D=09row addMorph:=0D=
=09=09(self=0D=09=09=09buildButton: SimpleButtonMorph new=0D=09=09=
=09target:  field=0D=09=09=09label: 'Active game'=0D=09=09=09selector=
: #restartPausedGame).=0D=09lifeDisplay :=3D LedMorph new=0D=09=09=
=09=09=09digits: 2;=0D=09=09=09=09=09extent: (2*10 at 15).=0D=09row addM=
orph: (self wrapPanel: lifeDisplay label: 'Lifes').=0D=09scoreDisplay=
 :=3D LedMorph new=0D=09=09=09=09=09digits: 6;=0D=09=09=09=09=09exten=
t: (5*10 at 15).=0D=09row addMorph: (self wrapPanel: scoreDisplay label:=
 'Score:').=0D=09^ row! !=0D=0D!BreakOut methodsFor: 'initialize' sta=
mp: 'sd 7/30/2002 18:35'!=0Dupdate: aParameter=0D=0D=09aParameter =
=3D #score =0D=09=09ifTrue: [scoreDisplay value:  field score].=0D=
=09aParameter =3D #lifes=0D=09=09ifTrue: [lifeDisplay value:  field l=
ifes]! !=0D=0D!BreakOut methodsFor: 'initialize' stamp: 'sd 7/25/2002=
 22:40'!=0DwrapPanel: anLedPanel label: aLabel=0D=09"wrap an LED pane=
l in an alignmentMorph with a label to its left"=0D=0D=09| a |=0D=
=09a _ AlignmentMorph newRow=0D=09=09wrapCentering: #center; cellPosi=
tioning: #leftCenter;=0D=09=09hResizing: #shrinkWrap;=0D=09=09vResizi=
ng: #shrinkWrap;=0D=09=09borderWidth: 0;=0D=09=09layoutInset: 3;=0D=
=09=09color: color lighter.=0D=09a addMorph: anLedPanel.=0D=09a addMo=
rph: (StringMorph contents: aLabel). =0D=09^ a! !=0D=

--Boundary_(ID_lheptP+NijCfFOH+XeTzxA)
Content-type: text/plain; charset=ISO-8859-1; format=flowed
Content-transfer-encoding: QUOTED-PRINTABLE





Dr. St=E9phane DUCASSE (ducasse at iam.unibe.ch)=20
http://www.iam.unibe.ch/~ducasse/
  "if you knew today was your last day on earth, what would you do
  different? ... especially if, by doing something different, today
  might not be your last day on earth" Calvin&Hobbes


--Boundary_(ID_lheptP+NijCfFOH+XeTzxA)--




More information about the Squeak-dev mailing list