[Cuis-dev] custom morph with fixed size
ken.dickey at whidbey.com
ken.dickey at whidbey.com
Mon Aug 12 16:38:04 PDT 2024
On 2024-08-12 15:13, Mark Volkmann via Cuis-dev wrote:
> See the attached screenshot. Hard as I try, I haven't been able to
> figure out why the two red squares are different sizes. They are
> instances of a custom morph named PlaceholderMorph.
PlaceHolderMorph inherits from PlacedMorph, which supplies a default
LayoutSpec which scales to the space available.
vvv===vvv
layoutSpec
"Layout specific. Return the layout spec describing where the
receiver should appear in a proportional layout"
layoutSpec ifNotNil: [ :ls | ^ ls ].
layoutSpec := LayoutSpec useAll.
layoutSpec morph: self.
^ layoutSpec
^^^===^^^
Resizing the outer, containing LayoutMorph demonstrates this.
The LabelMorphs and PluggableButtonMorphs have default LayoutSpecs which
use the original morphExtent, so they are not scaled.
Using UI-MetaProperties to view the LayoutSpecs of various morphs and
play with their properties, then dynamically resizing the containing
LayoutMorph should sharpen your intuitions about what to expect.
HTH,
-KenD
More information about the Cuis-dev
mailing list