[Newbies] Expand TextMorph to encompass entire string?

Ron Teitelbaum ron at usmedrec.com
Thu Sep 8 02:58:48 UTC 2016


From: John-Reed Maffeo
Sent: Wednesday, September 7, 2016 10:37 PM


Ron / Dan, Thanks.


I have resolved the issue, by trying a lot of different, minor modifications to my methods; 59 versions of the most problematic one!


[Ron Teitelbaum] Excellent I’m glad you figured it out!


The answer to my question seems to be rooted in my choice of a #layoutPolicy: ( btw, what is the appropriate use of the # sign when talking about Smalltalk code?


[Ron Teitelbaum] # followed by some string literal indicates a symbol which are great for things like parameters (#spaceFill) which are easy to compare.  In the context of discussing code in an email I will sometimes use #foo to indicate a method name but I’m also likely to use  Object >> foo or anObject >> foo because of how the debugger shows messages.  Had you not asked the question “my choice of a #layoutPolicy: “ was perfectly understandable. 


) and specifying the height of containing morph based on the height of the largest contained morph.


Comment to anyone reading this in search of information, be patient and confident of finding a solution. Keep searching for answers and asking questions. 


---- begin

createEditMorphFor: dataItem title: string

            "Use a standard definition of the data entry elements in the form. The changes I make here will propagate to all the items in the form and keep the calling method cleaner"


            | container contents title |


            container := BorderedMorph new.

            container color: Color tan.

            container layoutPolicy: ProportionalLayout new.

            container  borderColor: Color tan.

            container hResizing: #spaceFill; hResizing: #spaceFill.



            title := StringMorph contents: string.

            title  emphasis: 1.

            contents :=TextMorph new contents: dataItem.

            contents wrapFlag: true.


            container height: contents height.

            container addMorph: title fullFrame:((LayoutFrame fractions: (0.0 @ 0.0 corner: 0.3@ 1))).

            ^ container addMorph: contents fullFrame:((LayoutFrame fractions: (0.3 @ 0.0 corner: 1.0 @ 1.0))).

--- end



On Mon, Sep 5, 2016 at 5:58 PM, Dan Norton <dnorton at mindspring.com> wrote:

Hi John,

It might be better to separate the labels from the text morph. Each of your current panes
would contain two morphs: a list morph with the labels and beside it a text pane with the text
associated with the selected label. Text panes wrap text well, but list panes do not.

 - Dan Norton

Beginners mailing list
Beginners at lists.squeakfoundation.org


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160907/5f6f2b31/attachment-0001.htm

More information about the Beginners mailing list