LayoutMorph ?

Hernan Tylim htylim at yahoo.com.ar
Mon Nov 14 23:27:16 UTC 2005


Hi Dave,

If you want a morph that will be able to contain other morphs, then any 
morph would do.

Example:

| p c r |
c := EllipseMorph new.
c color: Color lightBlue.
r := BorderedMorph new.
r color: Color yellow.
p := Morph new.
p layoutPolicy: ProportionalLayout new.
p addMorph: c fullFrame: (LayoutFrame fractions: ((0 at 0) corner: (1 at 0.5))).
p addMorph: r fullFrame: (LayoutFrame fractions: ((0 at 0.5) corner: (0.5 at 1))).
p openInHand.

Select all the above code and execute it (do it). Put the morph 
somewhere in your desktop and middle-click on it (to show the halo). Now 
you can use the bottom-right handle to resize this morph and you will 
see how the submorphs resize themselves always mantaining their 
relative-to-the-parent proportions.[*]

That is done with a ProportionalLayout layout policy which is the same 
one that SystemWindow uses. In squeak you have also a more comple 
TableLayout layout policy. To learn how to use TableLayout there is a 
tutorial available on Squeakmap.

*- Note  that you wont have resizable panels like in SystemWindows, 
though. That behavior is coded somewhere in that class.

Regards,
Hernán

Dave Mason wrote:

>I am looking for something like SystemWindow, but without the titlebar.
>In other words I'd like to specify areas of the canvas as rectangles to
>hold PluggableMorphs.
>
>So far, I haven't found anything like it.  I tried copying the
>addMorph:frame: code from SystemWindow, but there seems to be a lot more
>required.
>
>Sigh... Morphic looked like such a convenient system, but either the
>learning curve is just too high, or I am missing some piece of key
>information (or tutorial).  I've tried the stuff on the wiki, but I
>haven't found the key yet.
>
>../Dave
>
>
>  
>





More information about the Squeak-dev mailing list