[Newbies] PluggableTextMorph Layout Question
Marcel Taeumel
marcel.taeumel at hpi.de
Tue Apr 24 14:51:10 UTC 2018
Hi jrm,
LayoutFrames are only used by the ProportionalLayout, not the TableLayout. Creating such a "form layout" with TableLayout is possible if all labels get a fixed width and #hResizing to #rigid. The input fields then #hResizing to #spaceFill. Do it row by row.
Here is an example:
Here is the code, have fun :-) Yes, you should use an actual model for PluggableTextMorphs, not call #setText. Anyway :
loremIpsum := [:num |
((1 to: num)
collect: [:ea | Symbol allSymbols atRandom asString])
joinSeparatedBy: ' '].
container := Morph new.
container
color: Color sky;
layoutPolicy: TableLayout new;
listDirection: #topToBottom;
cellInset: 5;
layoutInset: 5;
extent: 500 at 1000.
10 timesRepeat: [
| row label inputSingle inputMulti |
row := Morph new.
row
color: Color aqua;
layoutPolicy: TableLayout new;
listDirection: #leftToRight;
cellPositioning: #topLeft;
cellInset: 5;
layoutInset: 5;
hResizing: #spaceFill;
vResizing: #shrinkWrap.
label := Symbol allSymbols atRandom asText asMorph.
label
autoFit: false;
width: 150.
inputSingle := PluggableTextMorph new.
inputSingle
setText: (loremIpsum value: 3 atRandom);
hResizing: #spaceFill;
height: TextStyle defaultFont height * 1.5;
wrapFlag: false;
acceptOnCR: true;
hideScrollBarsIndefinitely.
inputMulti := PluggableTextMorph new.
inputMulti
setText: (loremIpsum value: 10 atRandom);
hResizing: #spaceFill;
height: (50 + 100 atRandom);
wrapFlag: true;
hideHScrollBarIndefinitely.
row
addMorphBack: label;
addMorphBack: {inputSingle.inputMulti} atRandom.
container addMorphBack: row].
container openInHand.
Best,
Marcel
Am 23.04.2018 00:35:31 schrieb John-Reed Maffeo <jrmaffeo at gmail.com>:
_______________________________________________ Beginners mailing list Beginners at lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
In case the image embedded in the email did not come through; left image == asis.png, right image ==ShouldBe.png.
Thanks!
On Sun, Apr 22, 2018 at 8:44 AM, John-Reed Maffeo <jrmaffeo at gmail.com [mailto:jrmaffeo at gmail.com]> wrote:
I am trying to adjust the layouts of PluggableTextMorphs to eliminate scrollers and expand the boundaries to display larger blocks of text. Left image is current state, right image is what I would like to see. The attached change set contains the method that I use to create each row.
Right image was resized using the Halo.
Perhaps the question to ask is, "How do I create a PluggableTextMorph of a given width with the height set to a value large enough to contain all of the text?"
Thanks in Advance, jrm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20180424/b78e00b1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 56442 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20180424/b78e00b1/attachment-0001.png>
More information about the Beginners
mailing list