links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
FAQ: Entry Field in Morphic
Last updated at 4:04 pm UTC on 25 July 2022
How can I generate an entry field in Morphic?

"If you want to use TextMorph, two very useful methods are
The example below creates a fixed-width entry field in a morphic world:"

 tm := TextMorph new.
 tm contentsWrapped: ''; extent: 100@20. "this is the important stuff"

"If necessary set a font"
 tm beAllFont: ((TextStyle default fontOfSize: 36) emphasized: 1)

 (border := AlignmentMorph newRow) "this just makes the TextMorph easier =to see"
  position: 200@200;		
  borderWidth: 1;		
  borderColor: Color black;
  hResizing: #shrinkWrap;		
  vResizing: #shrinkWrap;		
  addMorph: tm.

  Project current world addMorph: border.
"or alternatively use (toDo: adapt code below)"

 myLayoutMorph := RectangleMorph new.
 myLayoutMorph layoutPolicy: TableLayout new.
 myLayoutMorph   position: 20 @ 200. 
 "center submorphs"
 myLayoutMorph listCentering: #center.
 myLayoutMorph wrapCentering: #center.
 myLayoutMorph width: 320.
 myLayoutMorph height: 240.
 myLayoutMorph color: Color white darker.

tm := TextMorph new.
tm contentsWrapped: ''; hResizing: #spaceFill; vResizing: #spaceFill. "this is the important stuff"
tm beAllFont: ((TextStyle default fontOfSize: 18) emphasized: 0).
myLayoutMorph addMorph: tm.
Project current world addMorph: myLayoutMorph.

Further decisions to make include:


See also

TextMorph examples