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 [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
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.
Morph>>orderedSubmorphs | 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 > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
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. semaphore changeTableLayout ; addMorph: red ; addMorph: yellow ; addMorph: green. semaphore openInWorld. 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. > > > Morph>>orderedSubmorphs > | 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 >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |