Still trying to kill that pesky morph......

Torge Husfeldt jean-jacques.gelee at gmx.de
Sun Oct 21 22:31:49 UTC 2001


Hear John,
You don't need that number!
The number is generated >from some internals of the morph when it is
dropped on the workspace. Then the new binding is created for _this_
workspace. I'm pretty sure that even if you guessed the right number you
wouldn't be able to kill the morph with WorldTimeMorph12345 delete.
Because there is no binding before. (This should be true for other
workspaces even after you generated the textual representation).

On the other hand I'm pretty sure you do something like:
WorldTimeMorph new
somewhere in your code. Fine. Just make sure you change that to
<myInstanceVariable> := WorldTimeMorph new
and everything is fine.
Now you can do:
<myInstanceVariable> delete
anywhere you want (that is: the instance variable must be visible
there).
No magic numbers involved.
Squeak on,
Torge

John Hinsley wrote:
> 
> Ned Konz wrote:
> >
> > On Saturday 20 October 2001 10:34 pm, John Hinsley wrote:
> >
> > > If not, it pops up Karl's
> > > WorldTimeMorph with a further dialogue box. Something like "This person
> > > lives in a different time zone! Do you still want to dial?" On clicking
> > > yes, the morph is deleted and the number dialled, on clicking no, the
> > > morph is deleted. Now, although a sort of hybrid functionality is
> > > possible, it seems neater, since we're calling the Morph from a block of
> > > code, to delete it from a block of code, too.
> >
> > So when you make the WorldTimeMorph, remember it in an instance or local
> > variable; when the button is pushed, delete the WorldTimeMorph (and the
> > dialog itself, presumably).
> 
> Well, that's what I've been trying to do (in my clumsy sort of way). But
> the problem seems to be that unless I can address the morph by
> (something like) worldtime2475 (or a variable representing that)
> "delete" simply isn't understood (I guess that this works like pid:
> without the number, I could be referring to an infinite number of
> WorldTimeMorphs). And I can't work out how to set or get that number
> (without dragging the damn morph onto the workspace, and, of course, the
> number changes every time an instance of the Morph is created, which is
> where we came in....). Even my attempts to write a "kill" method for
> WorldTimeMorph have come to naught (and that seems a strange way of
> doing it: it should be possible to use Morph's delete).
> 
> There's a lot here I don't understand (clearly!). But most obviously, I
> don't understand the relationship between morphs and submorphs and
> between properties and submorphs. I'm hopeless!
> 
> Cheers
> 
> John




More information about the Squeak-dev mailing list