[Cuis-dev] For Test: Layouts + EdgeWeight

Juan Vuletich juan at jvuletich.org
Fri May 29 13:22:26 PDT 2020


On 5/29/2020 11:39 AM, ken.dickey--- via Cuis-dev wrote:
> On 2020-05-29 01:56, Dan Norton wrote:
> ..
>>
>> I'm trying to simplify an example where a collection of small elipses
>> is not appearing when fed to LayoutMorph>>addAllMorphs: ...
>
>
> Something deeper going on here.
>
> In many #addMorph* methods there are Morph>>privateAdd* methods which 
> do the work and at the end:
>
>   self someSubmorphPositionOrExtentChanged
>
> the default implementation of which is (for Morph)
>
>   layoutNeeded := true
>
> This should cause the LayoutMorph to do a #layoutSubmorphs.
>
> One can override the add*Morph* methods as the attached, which will 
> probably remove the symptom, but we really need to understand why 
> setting #layoutNeeded to true does not trigger 
> LayoutMorph>>layoutSubmorphs.
>
> Juan?  Anyone?
>
> ??
> -KenD

What is actually needed is to add to LayoutMorph these methods:

privateAddAllMorphs: aCollection atIndex: index
     aCollection do: [ :m | m layoutSpec ].
     ^super privateAddAllMorphs: aCollection atIndex: index

privateAddMorph: aMorph atIndex: index
     aMorph layoutSpec.
     ^super privateAddMorph: aMorph atIndex: index

privateAddMorph: aMorph atIndex: index position: aPoint
     aMorph layoutSpec.
     ^super privateAddMorph: aMorph atIndex: index position: aPoint

Cheers,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich



More information about the Cuis-dev mailing list