[squeak-dev] Re: PluggableTextMorph >> getText

Andreas Raab andreas.raab at gmx.de
Tue Jan 12 03:45:57 UTC 2010


Ralph Boland wrote:
> In my project I modified PluggableTextMorph >> getText to be as follows:
> 
> getText
> 	"Retrieve the current model text"
> 
> 	| newText |
> 	getTextSelector isNil ifTrue: [^Text new].
> 	newText := (getTextSelector numArgs = 1)
> 		ifTrue: [model perform: getTextSelector with: self]
> 		ifFalse: [model perform: getTextSelector].
> 	newText ifNil: [^Text new].
> 	^newText shallowCopy
> 
> 
> The change allows the getTextSelector to pass an additional argument: self.
> I made this change because I wanted to know which PluggableTextMorph
> was asking for text.
> This is useful when one has large numbers of similar PluggableTextMorphs.
> Note that the method PluggableTextMorph >>  acceptTextInModel
> already does this so I didn't need to modify it.
> Thus I think my change makes PluggableTextMorph more consistent.
> 
> Any chance of this change being made a part of the Squeak image?

Generally speaking it looks like a useful improvement so push it into 
the inbox and we can see what it actually looks like. Hint: You can 
improve your chances by adding tests :-)

Cheers,
   - Andreas




More information about the Squeak-dev mailing list