Mouse event problems.

Joshua 'Schwa' Gargus schwa at cc.gatech.edu
Thu May 30 05:01:39 UTC 2002


On Wed, May 29, 2002 at 08:59:26PM -0400, Caitlin Rene Bovee wrote:
> I am trying to write a mouseDown method and a mouseUp method which will
> return to me the coordinates of the mouse at those points. However, I
> can't ever seem to get a value. This is the only piece of code I have:
> startCoord :=self position.

Am I correct to assume that startCoord is either an instance variable or
a temp in a method of a subclass of Morph?  (my answer below assumes so)

> 
> Do I need to use super? The way I am testing this is printing out the
> values to the transcript when I use the function which manipulates my
> sketchPad PluggableButtonMorph.

If you want the position of the mouse cursor, you should ask the mouse
event for its position instead of asking the morph that received the 
event.  Your code might look something like (this method should be
defined in a subclass of Morph) :

mouseDown: evt
	| startCoord ... |

	...
	startCoord := evt position.
	...


Hope this helps,
Joshua



> 
> I also have other buttons to set various tools for the sketch pad and the
> tool variable is set correctly when the button is pushed.
> 
> I have no idea what I am missing, but any help would be appreciated.
> 
> Thanks,
> 
> Caitlin Bovee
> Email:
> 	gte049l at prism.gatech.edu
> 	stasid at cc.gatech.edu
> 



More information about the Squeak-dev mailing list