[Cuis] Newbie question

Juan Vuletich juan at jvuletich.org
Sat Apr 4 17:56:56 CDT 2015


On 4/2/2015 9:24 PM, Dan Norton wrote:
> On 2 Apr 2015 at 16:53, Phil (list) wrote:
>
>> On Thu, 2015-04-02 at 16:33 -0400, Dan Norton wrote:
> [snip]
>>> A simple solution is to have #name as an instance variable with 2
>> supporting
>>> methods: #name: and #printOn: . When #name: 'foo' is OPTIONALLY
>> sent, the
>>> name will appear  as "a BorderedRectMorph(1639)'foo'" when you
>> middle click on
>>> the morph.
>>>
>> Rather than adding an ivar, why not just use a Morph property?
>> (i.e.
>> #setProperty:toValue: and #valueOfProperty:)
>>
> +1
>
> Morph>>printOn: could do the job with one line added:
>
> printOn: aStream
>
> 	super printOn: aStream.
> 	aStream nextPutAll: '('.
> 	aStream
> 		print: self identityHash;
> 		nextPutAll: ')'.
> 	self valueOfProperty: #morphName ifPresentDo: [:x | aStream nextPutAll: x asString]
>

Yes, that's a good idea.

Cheers,
Juan Vuletich




More information about the Cuis mailing list