[squeak-dev] Morphic layout

Antony Blakey antony.blakey at gmail.com
Fri Oct 17 06:32:55 UTC 2008


Use addMorphBack: rather than addMorph:

On 17/10/2008, at 12:38 PM, R. Mark Volkmann wrote:

> 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'

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Some defeats are instalments to victory.
   -- Jacob Riis





More information about the Squeak-dev mailing list