Re: Help with mouseDrag event

John McCormick <[email protected]> Wed, 16 Apr 2008 15:26:45 -0500
Newsgroups gmane.comp.python.pythoncard
Message-ID <[email protected]>
Alex Schenkman wrote:
> I am trying to drag an image over other images.
> The problem is that the coordiantes I get with event.position are 
> relative to the component right under, and I would need absolute 
> coordinates, since I have many images on top of my background.

I found the specific functions I was thinking of:
wx.Window.ScreenToClient
wx.Window.ClientToScreen

So, if you can get the component that your size is relative to, you 
could do:

screen_pos = right_under.ClientToScreen(event.position)
absolute_pos = background.ScreenToClient(screen_pos)

Does that make sense?
I've never done anything like this in PythonCard/wxWidgets, but similar 
approaches in other systems have worked out for me in the past.

--
John McCormick

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone