Hi,
 
I guess that properly you should do:
 
    (self globalPointToLocal: event position) - self position
 
which should deal with the case of being embedded in a scroll pane or other transform

Regards, Gary
----- Original Message -----
From: Erwan Douaille
To: Pharo-project@lists.gforge.inria.fr ; ma.chris.m@gmail.com
Sent: Thursday, May 03, 2012 8:35 AM
Subject: Re: [Pharo-project] Mouse handler on a morph

Okay, but i didn't find anything with globalToLocal. And i've find another solution, just use soustraction for this problem : 

captureMouse: event
Transcript cr;show: event position - self position.

That's work too :)

Thanks ;)

2012/5/2 Chris Muller <asqueaker@gmail.com>
This is because, under rare circumstances, it is desirable to do
something in/on/to the desktop based on the position in the local
morph.

To get the local coordinates look for a method with the word "global"
in it -- globalToLocal: or something like that.  It's in Squeak, not
sure whether this is still in Pharo though..  If anything, you could
always just subtract the upperleft coordinate of your window from the
MouseEvent's position..

On Wed, May 2, 2012 at 9:02 AM, Erwan Douaille <douailleerwan@gmail.com> wrote:
> Hi.
>
> I would like to know if it's possible to add a mouse handler on a specific
> morph ?
> I have a window and i would like to know the position of my mouse only in
> this window.
>
> For exemple i also use :
>
> self on: #mouseDown send: #captureMouse: to: self.
>
> But it give me the mouse position in pharo environment and not only in my
> window.
>
>
> Thanks :)
>
> --
> Douaille Erwan <douaille.erwan@gmail.com>




--
Douaille Erwan <douaille.erwan@gmail.com>