[Cuis-dev] LayoutMorph example7 - how to constrain the size of SystemWindow object

H. Hirzel hannes.hirzel at gmail.com
Tue Oct 7 12:24:34 PDT 2025


Yes, that was it, thank you. Sending #minimumExtent to the top morph in 
the window (a LinearLayoutMorph) provided the solution.

Attached is the fixed LayoutMorph example7.

On 07/10/2025 7:35 pm, Juan Vuletich wrote:
> openInWorld first, then set morphExtent:
>
| c colorHexValue colorName r w colorHexValueLabel |
w := SystemWindow new setLabel: 'Color'.
r := LinearLayoutMorph newRow separation: 30 @ 10.
c := LinearLayoutMorph newColumn separation: 20 @ 10.
colorHexValue := '#FF00FF'.
colorHexValueLabel := LabelMorph contents: colorHexValue .
colorName := LabelMorph contents: 'magenta'.

r addMorph: colorHexValueLabel.
r addMorph: colorName.
c addMorph: (ColoredBoxMorph new color: (Color fromHexString: 
colorHexValue)).
c addMorph: r.
w addMorph: c .
w openInWorld.
w morphExtent: c minimumExtent.
-------------- next part --------------
'From Cuis7.5 [latest update: #7635] on 7 October 2025 at 9:16:21 pm'!

!LayoutMorph class methodsFor: 'LinearLayout examples' stamp: 'hjh 10/7/2025 21:15:48'!
example7
	"
	Useful example contributed by Ken Dickey
	self example7
	"
	"============================================"

| c colorHexValue colorName r w colorHexValueLabel |
w := SystemWindow new setLabel: 'Color'.
r := LinearLayoutMorph newRow separation: 30 @ 10.
c := LinearLayoutMorph newColumn separation: 20 @ 10.
colorHexValue := '#FF00FF'.
colorHexValueLabel := LabelMorph contents: colorHexValue .
colorName := LabelMorph contents: 'magenta'.

r addMorph: colorHexValueLabel.
r addMorph: colorName.
c addMorph: (ColoredBoxMorph new color: (Color fromHexString:  colorHexValue)).
c addMorph: r.
w addMorph: c .
w openInWorld.
w morphExtent: c minimumExtent.
! !



More information about the Cuis-dev mailing list