[Newbies] Can't open MorphLayoutArticle

Nicola Mingotti nmingotti at gmail.com
Thu Jul 25 17:59:23 UTC 2019


I could put together this example [code below], but I am stuck again on little things that are not so easy to find googling the docs.

1] How can I make the buttons fill all the third row length ? 
2] How do I embed newlines in textT1 string, I see '\n' is not working.  
3] How could i make the image in row4 fill its whole row (maybe same as [1])
4] How can I show the Squeak logo into image "i1" ? Just to have something nicer to display into examples.

m := RectangleMorph new.
m openInWindow.

"Initial size of the window".
(m owner) extent: 300 at 300. 
(m owner) setLabel: 'Layout test-1'.

m layoutPolicy: TableLayout new.
m listDirection: #topToBottom.
m hResizing: #spaceFill.
m vResizing: #spaceFill.
m color: Color yellow.

row0 := AlignmentMorph newRow color: (Color white); 
                hResizing: #spaceFill; vResizing: #spaceFill.

row1 := AlignmentMorph newRow color: (Color r:100 g:100 b: 100); 
                hResizing: #spaceFill; vResizing: #spaceFill.

row2 := AlignmentMorph newRow color: (Color r:300 g:300 b: 300); height: 50;
                hResizing: #spaceFill; vResizing: #fixed.

row3 := AlignmentMorph newRow color: (Color r:500 g:500 b: 500); 
                hResizing: #spaceFill; vResizing: #spaceFill.

m addMorphBack: row0.
m addMorphBack: row1.
m addMorphBack: row2.
m addMorphBack: row3.

t1 := TextMorph new.
t1 wrapFlag: true. 
textT1 := '-] Autoresize buttons to fills space ? \n'.
textT1 := textT1, '-] line 2. '. 
t1 contents: textT1. 
row0 addMorph: t1. 

10 timesRepeat: [row1 addMorph: (CircleMorph new extent: 10 at 10; color: Color blue)].

b1 := SimpleButtonMorph new. 
b1 borderWidth: 3 ; label: 'Button1'. 

b2 := SimpleButtonMorph new. 
b2 borderWidth: 3 ; label: 'Button2'. 

row2 addMorph: b1.
row2 addMorph: b2.

i1 := ImageMorph new. 
row3 addMorph: i1.


> On Jul 25, 2019, at 5:11 PM, John-Reed Maffeo <jrmaffeo at gmail.com> wrote:
> Hello Nicola,
> Check out https://wiki.squeak.org/squeak/52 <https://wiki.squeak.org/squeak/52> - How to lay out submorphs - example 1 
> There are several other layout links similar to this one.
> Note: AlignmentMorph has been deprecated, but it is still present in methods in current Squeak images.
> -jrm
> On Thu, Jul 25, 2019 at 1:14 AM Nicola Mingotti <nmingotti at gmail.com <mailto:nmingotti at gmail.com>> wrote:
> Hi,
> I am trying to understand the layout in Morph. I am familiar with other GUI toolkit as Tk, so It should not be a problem, I need just to see some simple examples. 
> It is quite difficult to find information about this subject. 
> I finally landed here:
> https://wiki.squeak.org/squeak/2400 <https://wiki.squeak.org/squeak/2400>
> Bue when I try to open the file "MorphLayoutArticle.pr" in Squeak 5.2 I get a lot of errors.
> Is there around a working version of MorphLayoutArticle ? 
> bye
> Nicola
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org <mailto:Beginners at lists.squeakfoundation.org>
> http://lists.squeakfoundation.org/mailman/listinfo/beginners <http://lists.squeakfoundation.org/mailman/listinfo/beginners>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20190725/c4ca47f6/attachment.html>

More information about the Beginners mailing list