I can't display a numer of Forms on a Form

Boris Gaertner Boris.Gaertner at gmx.net
Thu Apr 8 16:45:40 UTC 2004


"Trygve Reenskaug" <trygver at ifi.uio.no> wrote
<snip>
> I want to display a number of pictures on aForm scaled and moved to fit
> within given rectangles.
</snip>
<snip>
> Here's the code. The resulting red and blue rectangles are o different in
> both size and position.
>
>
> buildObjectsCompositeForm2
>     " R23CompositeMorph buildObjectsCompositeForm2 "
>     | form frames |
>     frames :=  { 6 at 2   corner: 449 at 238.
>                186 at 210 corner: 434 at 390.
>                505 at 218 corner: 653 at 388. }.
>     form := Form extent:  700 at 500 depth: 8.
>     form fillWithColor: Color yellow.
>    frames  do:
>        [:frame || subForm |
>        subForm := Form extent: frame extent depth: 8.
>        subForm fillWithColor: Color red.
>        subForm
>           displayOn: form
>           transformation:
>              (WindowingTransformation window: subForm boundingBox
viewport:
> frame)
>           clippingBox: (form boundingBox)].
>    frames  do:
>        [:frame || subForm |
>        subForm := Form extent: frame extent * 2 depth: 8.
>        subForm fillWithColor: Color blue.
>        subForm
>           displayOn: form
>           transformation:
>              (WindowingTransformation window: subForm boundingBox
viewport:
> frame)
>           clippingBox: (form boundingBox)].
>
>     form displayAt: 10 at 10.
>

#displayOn:transformation:clippingBox:
is inherited from DisplayObject, it calls

Form>>displayOn: transformation:clippingBox:
align:with:rule:fuillColor.

I think the align:with: is not what you need. At this
moment I fell myself unable to give you an example
where the alignment is helpful.
.
For better results, please try
  subForm
   displayOn: form
          transformation:
             (WindowingTransformation window: subForm boundingBox viewport:
frame)
          clippingBox: (form boundingBox)
          align: 0 at 0
          with: 0 at 0
          rule: Form over
          fillColor: nil


Greetings, Boris




More information about the Squeak-dev mailing list