Morph>>Delete

Laurence Rozier laurencerozier at yahoo.com
Wed Aug 27 05:35:06 UTC 2003


--- Avi Bryant <avi at beta4.com> wrote:
> 
> On Tue, 26 Aug 2003, Aaron J Reichow wrote:
> 
> > How to fix it?  Change "JeffsTestMorph delete." to
> "self delete." and you
> > should be OK.
> 
> The mouseDown: method he's implementing is on a
> button, not on an instance
> of JeffsTestMorph.  So "self" is not, in fact, what
> he wants.
> 
> Jeff, try this to get started.  In a workspace,
> evaluate each of these
> lines in turn:
> 
> jeffInst := JeffsTestMorph new.
> jeffInst openInWorld.
> jeffInst delete.
> 
> You can see there that #delete needs to be sent to a
> variable which is
> holding onto the particular instance of
> JeffsTestMorph that you created;
> not to the JeffsTestMorph class.
> 
> The trick is that your button needs to have a way of
> accessing this same
> instance.
That trick can sometimes be a not insignificant design
challenge. One quick and easy to get onscreen results
is to give the morph a name upon creation:

 jeffInst := JeffsTestMorph new.
 jeffInst openInWorld.
 jeffInst name: 'jeffInst'.

Now the button mouseDown or any other method can
access the instance by saying:

World submorphNamed: 'jeffInst'

Keep in mind that this approach doesn't eliminate
design decisions and it may also introduce a few new
ones.

Hope this helps!
> 
> > 2. The format for specifying a message is
> Class>>#message ; that is your
> > message should have read Morph>>#delete.
> 
> Really?  I use #delete to talk about the message,
> but Morph>>delete to
> talk about a particular method.
> 
> 
> 
> 
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



More information about the Squeak-dev mailing list