David,
Here is Andrew's example reworked a bit to achieve what I think you are after:
| outer aRow | outer _ RectangleMorph new extent: 400@100. aRow := AlignmentMorph newRow color: Color lightGreen. aRow addMorph: (TextMorph new width: 100; contentsWrapped: 'hellothere'; lock); addMorphBack: (AlignmentMorph newSpacer: Color blue); addMorphBack: (TextMorph new width: 100; contentsWrapped: (12323 printString); rightFlush; lock). outer addMorph: aRow. outer openInWorld.
This works in Morphic and MVC, BTW.
I tried your original code (or, rather, Andrew's runnable version) and both fields were editable on my system (2.2). Sending #lock seems to have corrected that.
Sending #rightFlush to the second field gets it lined up as desired.
I set an explicit width for both text fields since the results would be data dependent otherwise.
Cheers, Bob
On Sat, 26 Dec 1998 22:10:45 -0500 "Pennell's" pennell@tiac.net wrote:
I'm trying to create a row on a pane with a left justified name, some space and a right justified number.
I created the row as follows:
aRow := AlignmentMorph newRow color: aColor. aRow addMorph: (TextMorph new contents: aName); addMorphBack: (AlignmentMorph newSpacer: Color transparent); addMorphBack: (TextMorph new contents: aNumber printString).
Everything displays correctly, but:
- Why is the first submorph left justified and the last one right justified?
- Why does the first submorph allow editing and the last one doesn't?
- How can I prevent editing? I want display only. I tried to use StringMorph's but after much experimentation with wrapping in AlignmentMorphs, I trimmed the example down to this.
Thanks - I'm finally trying to learn Morphic so I can teach a 14 year old... -david
squeak-dev@lists.squeakfoundation.org