DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

A Smart Trash Can, Delet All Morphs Of Same Class

04.09.2005
| 2586 views |
  • submit to reddit
        TrashCanMorph subclass: #SmartTrashCanMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'SqueakRos'

initialize
	"Initialize the receiver's graphics, name, and balloon-help"
	super initialize.
	self image: TrashPicOn;
		 offImage: TrashPic;
		 pressedImage: TrashPicOn.
	self setNameTo: 'SmartTrash'.
	self setBalloonText: 'Drag some morph here . Removes all morph of same class'

acceptDroppingMorph: aMorph event:  evt 
 ActiveWorld submorphs copy do: [:each | (each class  == aMorph class ) ifTrue: [each delete]].