Re: Morphs with Spec2
Posted by
Sebastian Jordan on
Mar 20, 2020; 4:41pm
URL: https://forum.world.st/Morphs-with-Spec2-tp5113524p5113591.html
Hi,
It worked. For center the morph I do it in the naive way. I called the method position: of the morph.
Thanks,
Sebastian Jordan
De: Pharo-users <[hidden email]> en nombre de Esteban Lorenzano <[hidden email]>
Enviado: jueves, 19 de marzo de 2020 05:25
Para: Any question about pharo is welcome <[hidden email]>
Asunto: Re: [Pharo-users] Morphs with Spec2
Hi,
1. Spec styles define a “default” font applied to all components (morphs in this case) that understand font, and if you want to change it you need to define your own style.
2. A string morph cannot center the string (this is a morphic stuff)
You can solve your problem by adding a PanelMorph instead a string:
obtainSpMorphPresenterwithAStringMorph
| morph |
morph := StringMorph
contents: 'A String Morph'
font:
(LogicalFont
familyName: Smalltalk ui theme labelFont familyName
pointSize: Smalltalk ui theme labelFont pointSize + 10).
^ SpMorphPresenter new
morph: (PanelMorph new
addMorphBack: morph;
yourself);
yourself
This will produce this morph:
And since I hate morphic, I will let you to fight with morph to center your sub morph ;)
Esteban
button1 := self newButton.