[squeak-dev] Morphic layout

R. Mark Volkmann mark at ociweb.com
Fri Oct 17 02:08:54 UTC 2008


I'm trying to learn basic Morphic.  Can someone tell me why the following code
results in buttons labelled 1 through 4 from right to left instead of left to
right?  Any comments about this code are welcomed!

	| panel |

	panel := Morph new.
	panel
		layoutPolicy: TableLayout new;
		listDirection: #leftToRight;
		hResizing: #shrinkWrap;
		vResizing: #shrinkWrap;
		layoutInset: 30;
		cellInset: 10.

	"Why are buttons added in reverse order?"
	(1 to: 4) do: [:i |
		| button |
		button := PluggableButtonMorph
			on: [Transcript show: 'pressed'; cr]
			getState: nil
			action: #value.
		"Why is the color ignored?"
		button color: Color yellow; label: 'Button #', i asString.
		panel addMorph: button
	].

	panel openInWindowLabeled: 'Mark''s Morphic Demo'

-- 
R. Mark Volkmann
Object Computing, Inc.



More information about the Squeak-dev mailing list