Morph>>Delete
Aaron J Reichow
reic0024 at d.umn.edu
Wed Aug 27 03:43:29 UTC 2003
On Tue, 26 Aug 2003, Jeff Longland wrote:
> I'm trying to create a button that will delete a morph named JeffsTestMorph
> (sublass of Morph). Through inheritance, JeffsTestMorph inherits the delete
> method does it not? On mouseDown for my button, I have the following:
>
> mouseDown: evt
> JeffsTestMorph delete.
>
> But when I click on the button I get MessageNotUnderstood: delete. Could
> someone tell this Squeak newbie what he's doing wrong?
What you are doing wrong is sending the #delete message to the class
JeffsTestMorph rather than an instance of JeffsTestMorph, which would be
the actual morph you see. In Smalltalk, you can have instance methods and
class-side methods... Since you want to delete a specific JeffsTestMorph,
it is an instance-side method, and you send it to the instance.
How to fix it? Change "JeffsTestMorph delete." to "self delete." and you
should be OK.
And a couple other tips-
1. Message names are case sensitive. The subject line you used reads
"Morph>>Delete" - the message is delete, and Delete wouldn't work.
2. The format for specifying a message is Class>>#message ; that is your
message should have read Morph>>#delete.
3. Your code attempts to call JeffsTestMorph class>>#delete, but as I say
above, you mean to call JeffsTestMorph>>#delete.
Regards,
Aaron
--
"a system based on exchanging products inevitably channels wealth to a few, and
no governmental change will ever be able to correct that." :: daniel quinn
More information about the Squeak-dev
mailing list
|