<div dir="ltr">For the todo app I built as a learning exercise I ended up defining two classes that are subclasses of morph subclasses. I'm wondering if the approach I took is a recommended approach.<div><br></div><div>I defined the class PluggableScroll2Pane which is a subclass of PluggableScrollPane because I wanted to register a block to be evaluated every time its extent changes. It only adds the instance variable <font face="monospace">onExtentChanged</font> and these instance methods:</div><div><br></div><div><font face="monospace">onExtentChanged: aBlock<br>    onExtentChanged := aBlock</font></div><div><br></div><div><font face="monospace">extentChanged: oldExtent<br>    super extentChanged: oldExtent.<br>    onExtentChanged ifNotNil: [ onExtentChanged value: self morphExtent ].</font></div><div><font face="monospace"><br></font></div><div>I defined the class TextEntry2Morph which is a subclass of TextEntryMorph because I wanted to register a block to be evaluated every time it has focus and the user presses the escape key. It only adds the instance variable <font face="monospace">escapeAction</font> and these instance methods:<br></div><div><br></div><div><font face="monospace">escapeAction: aBlock<br>    escapeAction := aBlock</font></div><div><br></div><div><font face="monospace">escapeAction<br>    ^ escapeAction</font></div><div><font face="monospace"><br></font></div><div><span style="font-family:monospace">keyStroke: aKeyboardEvent</span><br></div><div><font face="monospace">    (aKeyboardEvent isEsc and: (escapeAction isNil not))<br>        ifTrue: [       escapeAction value ]<br>        ifFalse: [ super keyStroke: aKeyboardEvent ]</font></div><div><br></div><div>Is there a way I could have achieved the same goals without creating new subclasses?</div><div>I welcome any critique of this code.<br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><font face="arial, helvetica, sans-serif">R. Mark Volkmann</font></div><div><span style="font-size:12.8000001907349px"><font face="arial, helvetica, sans-serif">Object Computing, Inc.</font></span></div></div></div></div></div></div></div></div></div></div>