[Pharo-project] Explicit ordering of submorphs
fernando.olivero at usi.ch
Fri Oct 22 08:49:50 EDT 2010
To evidence this problem:
red := Morph new.
red color: Color red.
yellow := Morph new.
yellow color: Color yellow.
green := Morph new.
green color: Color green.
semaphore := Morph new.
addMorph: red ;
addMorph: yellow ;
You see that the semaphore is not correctly laid out.
Of course you could add them in inverse order, or play with the #morphicLayerNumber....but i think that this ordering should be explicit.
On Oct 22, 2010, at 2:45 PM, Fernando olivero wrote:
> In order to provide compatibility with the existing Morphs, i've propose that the if any submorphs does not use #precedence, the behavior defaults to #submorphs.
> | usePrecedence morphs |
> usePrecedence := submorphs anySatisfy:[:each| each precedence = 0 ].
> usePrecedence not ifTrue:[ ^ submorphs ].
> morphs := submorphs select: #visible.
> morphs sort: [:a :b| a precedence <= b precedence ].
> ^ morphs
> On Oct 22, 2010, at 2:35 PM, Fernando olivero wrote:
>> Currently, the submorph order isn't explicit.
>> Which means that adding several submorphs in a certain order, is no guarantee that they will appear in the desired order when laid out using a LayoutPolicy. Because the #morphicLayoutNumber is used.
>> I've propose the following:
>> 1. Add Morph>>precedence
>> 2. Add Morph>>orderedSubmorphs
>> 3. Modify the existing LayoutPolicies to use orderedSubmorphs instead of submorphsDo:
>> ISSUE 3136.
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
More information about the Pharo-dev