From: Oliver S. <oli...@si...> - 2012-01-15 18:01:08
|
In my drag/drop test, I have a "source" dialog and two "target" dialogs. The two targets are two instances of the same dialog class. However, the mapWindowPoints() does not map correctly when I move the mouse over the second target dialog (or sometimes over the first) - the mapping is to a place well away from the target dialog (sometimes above, sometimes below). Hence the cursor does not get set correctly (it stays as NoEntry until I get to the place where it thinks it's mapping to the dialog). On the mouse move event, I do the following (aside from other things of course): say "DragManager-moving-01a: hwnd/mousePos =" hwnd "/" mousePos sourceDlg~mapWindowPoints(hwnd, mousePos) say "DragManager-moving-01b: hwnd/mousePos =" hwnd "/" mousePos When I'm over the target dialog (but the mouse is still "no-entry"), the command prompt shows, for example: DragManager-moving-01a: hwnd/mousePos = 0x003B07D8 / a Point (-205, 192) DragManager-moving-01b: hwnd/mousePos = 0x003B07D8 / a Point (-205, -133) Is this my code, or could there be a problem with mapWindowPoints()? Many thanks, Oliver |
From: Mark M. <mie...@gm...> - 2012-01-15 19:54:26
|
On Sun, Jan 15, 2012 at 10:01 AM, Oliver Sims < oli...@si...> wrote: > ** > In my drag/drop test, I have a "source" dialog and two "target" dialogs. > The two targets are two instances of the same dialog class. > > However, the mapWindowPoints() does not map correctly when I move the > mouse over the second target dialog (or sometimes over the first) - > the mapping is to a place well away from the target dialog (sometimes > above, sometimes below). Hence the cursor does not get set correctly (it > stays as NoEntry until I get to the place where it thinks it's mapping to > the dialog). > > On the mouse move event, I do the following (aside from other things of > course): > > say "DragManager-moving-01a: hwnd/mousePos =" hwnd "/" mousePos > sourceDlg~mapWindowPoints(hwnd, mousePos) > That statement looks suspect to me. mapWindowPoints() maps points from the reciever window to a destination window. ('reciever' window meaning the window object receiving the message.) The mouse move event will supply co-ordinates as client co-ordinates of window the mouse is over, or as client co-ordinates of the window that has captured the mouse. So, assuming that sourceDlg is the window object that has captured the mouse, and possibleDestinationDlg is a second dialog that you want to test, the code should be this: sourceDlg~mapWindowPoints(possibleDestinationDlg~hwnd, mousePos) > say "DragManager-moving-01b: hwnd/mousePos =" hwnd "/" mousePos > > When I'm over the target dialog (but the mouse is still "no-entry"), the > command prompt shows, for example: > > DragManager-moving-01a: hwnd/mousePos = 0x003B07D8 / a Point (-205, 192) > DragManager-moving-01b: hwnd/mousePos = 0x003B07D8 / a Point (-205, -133) > > Is this my code, or could there be a problem with mapWindowPoints()? > > It could be a problem with mapWindowPoints(), because what you show there doesn't fit with my idea that you are using mapWindowsPoints() incorrectly. If my explanation of mapWindowPoints above doesn't clear things up for you, send your code to me at my gmail address so I can take a look at it. -- Mark Miesfeld |
From: Oliver S. <oli...@si...> - 2012-01-20 17:33:11
|
I said: Btw, why a new method on mousePos? Isn't it a Point? If so, then wouldn't: screenPt = mousePos be OK? Please ignore - it was a silly question. -- Oliver Sims _____ From: Oliver Sims [mailto:oli...@si...] Sent: 20 January 2012 17:14 To: 'Mark Miesfeld' Subject: RE: [Oorexx-devel] ooDialog - mapWindowPoints() Many thanks, Mark. Look forward to new build. Btw, why a new method on mousePos? Isn't it a Point? If so, then wouldn't: screenPt = mousePos be OK? -- Oliver Sims _____ From: Mark Miesfeld [mailto:mie...@gm...] Sent: 17 January 2012 22:28 To: Oliver Sims Subject: Re: [Oorexx-devel] ooDialog - mapWindowPoints() On Tue, Jan 17, 2012 at 1:44 PM, Mark Miesfeld <mie...@gm...> wrote: Here is a first cut an resolving the problem. It works, to a degree: Here is a solution that works to my satisfaction: do i over self~targetDialogs -- items: 1 = hwnd, 2 = droparea hwnd = self~targetDialogs[i][1] droparea = self~targetDialogs[i][2] screenPt = mousePos~copy sourceDlg~client2screen(screenPt) screenHwnd = .DlgUtil~windowFromPoint(screenPt) pDlg = mousePos~copy sourceDlg~mapWindowPoints(hwnd, pDlg) childHwnd = i~childWindowFromPoint(pDlg) --say "DragManager-moving-00: hwnd =" hwnd " mousPos =" mousePos if screenHwnd == childHwnd then do p1 = mousePos~copy sourceDlg~mapWindowPoints(hwnd, p1) if p1~inRect(droparea) then do targetDlg = i leave -- Stop looping - target found! end end end I'll try to build a switch ooDialog that contains the new methods: Mouse::copy(), DlgUtil::windowFromPoint(), and DialogObject::childWindowFromPoint() so that you can work with them. -- Mark Miesfeld |