Last updated at 2:15 pm UTC on 7 January 2022
Use the text below as a start for the StringMorph class comment
StringMorph is a subclass of Morph. It has the following additional instance variables:
- font (normally nil; then the accessor #font gives back TextStyle defaultFont)
- contents (aString)
Inherited from the class Morph are the following instance variables:
It further has 20 or more subclasses.
StringMorph allSubclasses size 21 "Squeak 5.3"
The color of a StringMorph object applies to the font, not the background.
How to construct a StringMorphs with a particular font
See StringMorph examples - Bitmap DejaVu Sans 9, 18, 36
Edit content of StringMorph
If you shift-click on a StringMorph you can edit it's string.
This is accomplished the following way:
class StringMorph overrides the message #mouseDown: and then tests
(evt shiftPressed and: [self wantsKeyboardFocusOnShiftClick]) and if it is true it launches a StringMorphEditor.
StringMorph as a button
A StringMorph may as well be used like a SimpleButtonMorph to do an action when clicked.
Use the menu 'extras' / 'add mouseUpAction'.
The following propery will be defined:
aStringMorph valueOfProperty: #mouseUpCodeToRun
see Morph mouse up action (Smalltalk expression)
StringMorph and SimpleButtonMorph example -- another counter
You can add custom menu entries to any Morph, see Morph menus.