Halo and Morph Copy

Bob Arning arning at charm.net
Sat May 13 23:25:21 UTC 2000


On Sun, 14 May 2000 23:56:22 +0100 "Jonathan Coupe" <jonathan at meanwhile.freeserve.co.uk> wrote:
>When I use the green "duplicate" blob in a Morph's halo, how is the copy
>performed?
>I'm trying to keep track of all instances of a particular class, and I need
>to register instances created by copying.
>
>More generally, is there a way I can obtain this information efficiently,
>say by using some kind of stepper? So far I've tried using MessageTally,
>hoping it will pickup the copy operation (it didn't seem to, maybe I didn't
>recognize it.) And I've tried guessing which function might be used (one of
>the Morph copy operations like fullCopy seemed most likely - perhaps I
>should look above to Object) and then planting shows in the subclass
>function.

Jonathon,

Here's a way that gets there fairly quickly: 

- Since the balloon help for the green halo says "Duplicate", I searched for methods referencing strings containing "Duplicate" (type Duplicate and control-e).

- This found 9 methods, one of which was Morph>>balloonHelpTextForHandle: containing a line like
		(doDup:with:							'Duplicate')

- Implementors of #doDup:with: leads to HaloMorph

doDup: evt with: dupHandle
	"Ask hand to duplicate my target."

	evt hand setArgument: target.
	self setTarget: evt hand duplicateMorph.
	self removeAllHandlesBut: dupHandle

- Implementors of duplicateMorph leads to HandMorph

duplicateMorph
	| newMorph aName usedNames |
	newMorph _ argument veryDeepCopy.
[..snip..]

Cheers,
Bob





More information about the Squeak-dev mailing list