Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions chapter-02/contents.texinfo
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ subclasses:
Instances of @class{LayoutSpec} have @smalltalk{morph} as an instance
variable. There are methods to set each of these instance variables.

@smalltalkExample{box2 layoutSpec proportionalWidth: 1}
@smalltalkExample{box2 layoutSpec: (LayoutSpec proportionalWidth: 1)}

@figure{Using proportionalWidth, ch03-layoutmorph-example7, 6}

Expand All @@ -198,7 +198,7 @@ message @msg{add:proportionWidth:} which adds a submorph and sets the
However, an issue with this approach is that it creates a new instance
of @class{LayoutSizeSpec} and sets both @smalltalk{proportionalWidth}
and @smalltalk{proportionalHeight} to 1. To modify only one of those
properties, it is best to set it directly on the @class{LayoutSizedSpec}
properties, it is best to set it directly on the @class{LayoutSizeSpec}
instance of the morph.

@cindex layout @subentry spacer
Expand All @@ -211,9 +211,9 @@ box1 := ColoredBoxMorph new color: Color red; morphExtent: 50 @@ 75.
box2 := ColoredBoxMorph new color: Color green; morphExtent: 75 @@ 50.
box3 := ColoredBoxMorph new color: Color blue; morphExtent: 100 @@ 100.
spacer1 := ColoredBoxMorph new color: Color transparent.
spacer1 layoutSpec proportionalWidth: 1.
spacer1 layoutSpec: (LayoutSpec proportionalWidth: 1).
spacer2 := ColoredBoxMorph new color: Color transparent.
spacer2 layoutSpec proportionalWidth: 1.
spacer2 layoutSpec: (LayoutSpec proportionalWidth: 1).
layout := LayoutMorph newRow
morphExtent: 350 @@ 150;
separation: 10;
Expand Down Expand Up @@ -246,14 +246,14 @@ column1 := LayoutMorph newColumn
addMorph: (LabelMorph contents: 'Apple');
addMorph: (LabelMorph contents: 'Banana');
addMorph: (LabelMorph contents: 'Cherry').
column1 layoutSpec proportionalHeight: 0. "defaults to 1"
column1 layoutSpec: (LayoutSpec proportionalHeight: 0). "defaults to 1"

column2 := LayoutMorph newColumn
addMorph: (LabelMorph contents: 'Spring');
addMorph: (LabelMorph contents: 'Winter');
addMorph: (LabelMorph contents: 'Summer');
addMorph: (LabelMorph contents: 'Fall').
column2 layoutSpec proportionalHeight: 0. "defaults to 1"
column2 layoutSpec: (LayoutSpec proportionalHeight: 0). "defaults to 1"

row := LayoutMorph newRow
separation: 20;
Expand All @@ -277,15 +277,15 @@ column1 := LayoutMorph newColumn
addMorph: (LabelMorph contents: 'Banana');
addMorph: (LabelMorph contents: 'Cherry');
borderColor: Color red; borderWidth: 2.
column1 layoutSpec proportionalHeight: 0.
column1 layoutSpec: (LayoutSpec proportionalHeight: 0).

column2 := LayoutMorph newColumn
addMorph: (LabelMorph contents: 'Spring');
addMorph: (LabelMorph contents: 'Winter');
addMorph: (LabelMorph contents: 'Summer');
addMorph: (LabelMorph contents: 'Fall');
borderColor: Color blue; borderWidth: 2.
column2 layoutSpec proportionalHeight: 0.
column2 layoutSpec: (LayoutSpec proportionalHeight: 0).

center := LabelMorph contents: 'What are your favorites?' ::
borderColor: Color green; borderWidth: 2.
Expand Down
16 changes: 8 additions & 8 deletions chapter-04/contents.texinfo
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ button morphExtent: (extent x + 15) @@ extent y.
layout := window layoutMorph.
layout padding: 10.
window
morphExtent: 300 @@ layout minimumExtent y;
openInWorld.}
openInWorld;
morphExtent: 300 @@ layout minimumExtent y.}

@smalltalkMethod{toggleColor,
layout color: (
Expand Down Expand Up @@ -619,7 +619,7 @@ colorList := PluggableListMorph
listGetter: #colors
indexGetter: #selectedColorIndex
indexSetter: #selectedColorIndex:.
colorList layoutSpec proportionalWidth: 1.
colorList layoutSpec: (LayoutSpec proportionalWidth: 1).

newColorEntry := self textEntryOn: #newColor.
newColorEntry emptyTextDisplayMessage: 'new color'.
Expand Down Expand Up @@ -652,7 +652,7 @@ self selectedColorIndex: 0.
"Set window size to the smallest height that contains its submorphs."
layout := window layoutMorph.
layout separation: 10.
window morphExtent: 250 @ layout minimumExtent y}
window morphExtent: 250 @@ layout minimumExtent y}

Observe at the beginning of the @method{initialize} method the
creation of the list; its model is @smalltalk{self}, therefore an
Expand Down Expand Up @@ -695,7 +695,7 @@ potentialColor := aText asString withBlanksTrimmed.
potentialColor ifNotEmpty: [
colors add: potentialColor asSymbol.
colorList updateList.
self selectedColorIndex: (colors indexOf: potentialColor )
self selectedColorIndex: (colors indexOf: potentialColor ).
self changed: #clearUserEdits.
self changed: #newColor ]}

Expand All @@ -720,7 +720,7 @@ color of the window.
selectedColorIndex := anIndex.

selected := anIndex ~= 0.
deleteButton enable: selected.
deleteButton enableSelector: selected.
colorName := selected ifTrue: [ colors at: anIndex ].

selectedLabel contents: (colorName
Expand All @@ -743,7 +743,7 @@ entry := TextModelMorph
hideScrollBarsIndefinitely.

entry morphExtent: 0 @@ 0.
entry layoutSpec proportionalWidth: 1.
entry layoutSpec: (LayoutSpec proportionalWidth: 1).
@return{} entry}

@node Memory game
Expand Down Expand Up @@ -882,7 +882,7 @@ colors := self distributeColors shuffled.
row := LayoutMorph newRow.
1 to: size x do: [:x | | card |
card := MemoryCard model: self action: #flip: actionArgument: x@@y.
card layoutSpec proportionalWidth: 1; proportionalHeight: 1.
card layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1).
card cardColor: colors removeFirst.
row addMorph: card.
cards at: x@@y put: card ].
Expand Down
4 changes: 2 additions & 2 deletions chapter-05/contents.texinfo
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ size := model size.
action: #flip:
actionArgument: x@@y.
@dots{}
cardView layoutSpec proportionalWidth: 1; proportionalHeight: 1.
cardView layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1).
cardView color: cardModel backColor.
row addMorph: cardView].
playground addMorph: row ]}
Expand Down Expand Up @@ -489,7 +489,7 @@ cardModel
when: #lock send:#lock to: cardView;
when: #unlock send: #unlock to: cardView;
when: #flash send: #flash to: cardView.
cardView layoutSpec proportionalWidth: 1; proportionalHeight: 1.
cardView layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1).
@dots{}}

One last detail: to foster your understanding of the relation between these two
Expand Down
2 changes: 1 addition & 1 deletion misc/MemoryGameV1-untabbed.pck.st
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ installCards
row := LayoutMorph newRow.
1 to: size x do: [:x | | card |
card := MemoryCard model: self action: #flip: actionArgument: x@y.
card layoutSpec proportionalWidth: 1; proportionalHeight: 1.
card layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1).
card cardColor: colors removeFirst.
row addMorph: card.
cards at: x@y put: card ].
Expand Down
2 changes: 1 addition & 1 deletion misc/MemoryGameV1.pck.st
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ installCards
row := LayoutMorph newRow.
1 to: size x do: [:x | | card |
card := MemoryCard model: self action: #flip: actionArgument: x@y.
card layoutSpec proportionalWidth: 1; proportionalHeight: 1.
card layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1).
card cardColor: colors removeFirst.
row addMorph: card.
cards at: x@y put: card ].
Expand Down
2 changes: 1 addition & 1 deletion misc/MemoryGameV2-untabbed.pck.st
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ installCards
when: #lock send:#lock to: cardView;
when: #unlock send: #unlock to: cardView;
when: #flash send: #flash to: cardView.
cardView layoutSpec proportionalWidth: 1; proportionalHeight: 1.
cardView layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1).
cardView color: cardModel backColor.
row addMorph: cardView].
playground addMorph: row ]! !
Expand Down
2 changes: 1 addition & 1 deletion misc/MemoryGameV2.pck.st
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ installCards
when: #lock send:#lock to: cardView;
when: #unlock send: #unlock to: cardView;
when: #flash send: #flash to: cardView.
cardView layoutSpec proportionalWidth: 1; proportionalHeight: 1.
cardView layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1).
cardView color: cardModel backColor.
row addMorph: cardView].
playground addMorph: row ]! !
Expand Down
2 changes: 1 addition & 1 deletion misc/MemoryGameV3-untabbed.pck.st
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ installCards
when: #lock send:#lock to: cardView;
when: #unlock send: #unlock to: cardView;
when: #flash send: #flash to: cardView.
cardView layoutSpec proportionalWidth: 1; proportionalHeight: 1.
cardView layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1).
cardView color: cardModel backColor.
row addMorph: cardView].
playground addMorph: row ]! !
Expand Down
2 changes: 1 addition & 1 deletion misc/MemoryGameV3.pck.st
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ installCards
when: #lock send:#lock to: cardView;
when: #unlock send: #unlock to: cardView;
when: #flash send: #flash to: cardView.
cardView layoutSpec proportionalWidth: 1; proportionalHeight: 1.
cardView layoutSpec: (LayoutSpec proportionalWidth: 1 proportionalHeight: 1).
cardView color: cardModel backColor.
row addMorph: cardView].
playground addMorph: row ]! !
Expand Down
Loading