Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dependencies clean up: Move example in BlMorphicHost to BlMorphicHost…
…Examples
- Loading branch information
1 parent
af7441d
commit 0980047
Showing
2 changed files
with
44 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Class { | ||
#name : #BlMorphicHostExamples, | ||
#superclass : #BlExamplesTest, | ||
#instVars : [ | ||
'containerMorph' | ||
], | ||
#category : #'Bloc-Examples-Host - Morph' | ||
} | ||
|
||
{ #category : #examples } | ||
BlMorphicHostExamples >> squares [ | ||
<sampleInstance> | ||
<demo> | ||
|
||
| aMorph aHost aSpace | | ||
aMorph := Morph new. | ||
"container morph could also have #spaceFill resizing" | ||
aMorph extent: 400 asPoint. | ||
"Specify a layout policy so the Bloc space fills the whole | ||
extent (including Morph resizing)." | ||
aMorph layoutPolicy: TableLayout new. | ||
aMorph openInWindowLabeled: 'Resize window to layout. Hover squares to color.'. | ||
|
||
aHost := BlMorphicHost new. | ||
aHost containerMorph: aMorph. | ||
|
||
aSpace := BlSpace new. | ||
aSpace host: aHost. | ||
aSpace show. | ||
|
||
aSpace root | ||
background: Color paleBlue; | ||
layout: BlFlowLayout horizontal. | ||
|
||
50 timesRepeat: [ | ||
aSpace root addChild: | ||
(BlElement new | ||
background: Color random translucent; | ||
addEventHandlerOn: BlMouseEnterEvent | ||
do: [ :evt | evt target background: Color random ]; | ||
yourself) ]. | ||
|
||
^ aSpace | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters