Login  Register

Re: Morphs with Spec2

Posted by EstebanLM on Mar 19, 2020; 9:25am
URL: https://forum.world.st/Morphs-with-Spec2-tp5113524p5113541.html

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

On 18 Mar 2020, at 17:41, Sebastian Jordan <[hidden email]> wrote:


    button1 := self newButton.