PluggableTextMorph Layout Question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
jrm
Reply | Threaded
Open this post in threaded view
|

PluggableTextMorph Layout Question

jrm
  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





_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

BBCEpisodeMetadataEditor-createEditMorphFortitle.st (1K) Download Attachment
jrm
Reply | Threaded
Open this post in threaded view
|

Re: PluggableTextMorph Layout Question

jrm
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 <[hidden email]> 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






_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

AsIs.png (30K) Download Attachment
ShouldBe.png (37K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PluggableTextMorph Layout Question

marcel.taeumel
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@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 <[hidden email]>:

_______________________________________________ Beginners mailing list [hidden email] 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 <[hidden email]> 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






_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
jrm
Reply | Threaded
Open this post in threaded view
|

Re: PluggableTextMorph Layout Question

jrm
Marcel,

Thank you.  I will work through this example and see if I can use your ideas in my solution.

-jrm

On Wed, Apr 25, 2018 at 3:36 AM, Marcel Taeumel <[hidden email]> wrote:
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@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 <[hidden email]>:

_______________________________________________ Beginners mailing list [hidden email] 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 <[hidden email]> 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






_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners