ImageMorph events

Joshua 'Schwa' Gargus schwa at cc.gatech.edu
Thu Dec 27 01:49:01 UTC 2001


Hi Gary,

You could try something like:

firstCollection, secondCollection do: [:image | 
	image on: #mouseDown send: #twoArg:selector: to: self].

Look at EventHandler>>send:to:withEvent:fromMorph: to see what arguments will
be supplied when the event happens.  You can then define #twoArg:selector:
as follows:

twoArg: evt selector: morph
	(firstCollection includes: morph) 
		ifTrue: ["image is in the first collection"....]
		ifFalse: ["it must be in the second collection".....]


Hope this helps,
Joshua



On Wed, Dec 26, 2001 at 10:10:11PM -0000, Gary McGovern wrote:
> Hello,
> I've a class with a couple of instance variables that each reference an OrderedCollection of ImageMorphs.
> 
> How can I use the handleMouseDown: evt and mouseDown: evt methods with these OrderedCollections ? 
> 
> All the elements in one collection should have uniform behaviour on click and each element should have different behaviour in the second collection on clicking.
> 
> Or is there a better way to do that.
> 
> Thanks!
> Gary 




More information about the Squeak-dev mailing list