[Cuis-dev] Question about PlacedMorph
Alexandre Rousseau
yalexr at gmail.com
Thu Mar 23 08:09:04 PDT 2023
That makes sense. Thanks.
...
Subclassing PlacedMorph was a mistake in my case. I was better off, again,
subclassing LayoutMorph, ending up with this hierarchy:
LayoutMorph (self)
> - BoxMorph (lightBox)
> -- LayoutMorph (lightBoxLayout)
> --- BoxMorph (redLight)
> --- BoxMorph (yellowLight)
> --- BoxMorph (greenLight)
Then, calling "lightBox morphExtent: lightBoxLayout minimumExtent" was
sufficient to pack everything to perfection.
[image: Screenshot 2023-03-23 at 11.08.12 AM.png]
On Thu, Mar 23, 2023 at 10:07 AM <ken.dickey at whidbey.com> wrote:
> On 2023-03-23 06:54, Alexandre Rousseau via Cuis-dev wrote:
>
> > PlacedMorph subclass MyClass is initialized such that it contains
> > several submorphs.
> >
> > What is the simplest way, from inside initialize, to ensure that my
> > instance's extent is such that all of its submorphs are visible? (or
> > must I specify this manually via morphExtent:?)
>
> Using a LayoutMorph will do this for you. A LayoutMorph resizes to
> contain its submorphs.
>
> You may not want the LayoutMorph placement, however.
>
> To resize the PlacedMorph yourself, see details in
> LayoutMorph>>minimumExtent
>
> HTH,
> -KneD
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230323/a8297acf/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2023-03-23 at 11.08.12 AM.png
Type: image/png
Size: 16739 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230323/a8297acf/attachment.png>
More information about the Cuis-dev
mailing list