Here's a fun way to kill a few braincells. I've been tearing much hair out for the last couple of days trying to work this one out; why do my morphs not go where they ought?
Consider a morph with a submorph AlignmentMorph (I know, you don't need to use AlignmentMorphs so much now) that in turn contains two morphs. Set the alignmenmorph's right to the main morphs right-10. Open it; what do you expect? I'd expect to find the pair of morphs lined up near the main morphs right side.
Nah. Don't be silly.
Try out this code - |m am| m := Morph new color: Color white; extent: 200@100. am := AlignmentMorph newRow hResizing: #shrinkWrap; vResizing: #shrinkWrap; listDirection: #leftToRight; color: Color transparent. am addMorph: (Morph new color: Color red; extent: 37@51). am addMorph: (Morph new color: Color blue; extent: 43@51). m addMorph: am. am right: m right -10. am top: m top +2. m openInWorld
Now change the listDirection: #leftToRight; to listDirection: #rightToLeft and see what happens. I think that is just plain wrong.
Better yet, add 'am right: m right -10.' after the openInWorld. Now it goes where you expect. So, what is changing things, why, is it a bug that can be fixed, what the hell?
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful random insult:- His shared libraries aren't installed.
|m am| m := Morph new color: Color white; extent: 200@100. am := AlignmentMorph newRow hResizing: #shrinkWrap; vResizing: #shrinkWrap; listDirection: #leftToRight; color: Color transparent. am addMorph: (Morph new color: Color red; extent: 37@51). am addMorph: (Morph new color: Color blue; extent: 43@51). *am fullBounds. "<<<<<<<<<"* m addMorph: am. am right: m right -10. am top: m top +2. m openInWorld
Tim,
am right: m right - 10
sets the right edge of am before am has adjusted its size base on its submorphs. Add the line marked above. Normally you would let the alignment-style properties ripple down and up the tree and all would be cool. Your insertion of manual positioning needed the extra step.
Cheers, Bob
On 7/31/13 9:09 PM, tim Rowledge wrote:
Here's a fun way to kill a few braincells. I've been tearing much hair out for the last couple of days trying to work this one out; why do my morphs not go where they ought?
Consider a morph with a submorph AlignmentMorph (I know, you don't need to use AlignmentMorphs so much now) that in turn contains two morphs. Set the alignmenmorph's right to the main morphs right-10. Open it; what do you expect? I'd expect to find the pair of morphs lined up near the main morphs right side.
Nah. Don't be silly.
Try out this code - |m am| m := Morph new color: Color white; extent: 200@100. am := AlignmentMorph newRow hResizing: #shrinkWrap; vResizing: #shrinkWrap; listDirection: #leftToRight; color: Color transparent. am addMorph: (Morph new color: Color red; extent: 37@51). am addMorph: (Morph new color: Color blue; extent: 43@51). m addMorph: am. am right: m right -10. am top: m top +2. m openInWorld
Now change the listDirection: #leftToRight; to listDirection: #rightToLeft and see what happens. I think that is just plain wrong.
Better yet, add 'am right: m right -10.' after the openInWorld. Now it goes where you expect. So, what is changing things, why, is it a bug that can be fixed, what the hell?
tim
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful random insult:- His shared libraries aren't installed.
On 31-07-2013, at 6:25 PM, Bob Arning arning315@comcast.net wrote:
am right: m right - 10
sets the right edge of am before am has adjusted its size base on its submorphs. Add the line marked above. Normally you would let the alignment-style properties ripple down and up the tree and all would be cool. Your insertion of manual positioning needed the extra step.
OK, that even makes sort of sense. Thank you for saving my hairline!
Now, as my supplemental question, how *should* it be done to avoid the manual fudge? Let's say I want several buttons stacked up against the left edge of my main morph, then a group of buttons that will keep their left edge aligned with another morph below this row, then another group of buttons stacked with their collective right edge near the right edge of my main morph? I'm sort of seeing some possible ways but to be honest this layout stuff is pretty opaque unless you have done a fair bit of it.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: BZR: Branch if piZza Ready
|m am| m := AlignmentMorph newRow color: Color white; extent: 200@100. am := AlignmentMorph newRow hResizing: #spaceFill; vResizing: #shrinkWrap; listDirection: #leftToRight; listCentering: #bottomRight; color: Color transparent. am addMorph: (Morph new color: Color red; extent: 37@51). am addMorph: (Morph new color: Color blue; extent: 43@51). m addMorph: am. m openInWorld
Cheers, Bob
On 7/31/13 9:40 PM, tim Rowledge wrote:
On 31-07-2013, at 6:25 PM, Bob Arning arning315@comcast.net wrote:
am right: m right - 10
sets the right edge of am before am has adjusted its size base on its submorphs. Add the line marked above. Normally you would let the alignment-style properties ripple down and up the tree and all would be cool. Your insertion of manual positioning needed the extra step.
OK, that even makes sort of sense. Thank you for saving my hairline!
Now, as my supplemental question, how *should* it be done to avoid the manual fudge? Let's say I want several buttons stacked up against the left edge of my main morph, then a group of buttons that will keep their left edge aligned with another morph below this row, then another group of buttons stacked with their collective right edge near the right edge of my main morph? I'm sort of seeing some possible ways but to be honest this layout stuff is pretty opaque unless you have done a fair bit of it.
tim
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: BZR: Branch if piZza Ready
squeak-dev@lists.squeakfoundation.org