[Oorexx-devel] ooDialog - mapWindowPoints()
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 -- RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2___ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel
Re: [Oorexx-devel] ooDialog - mapWindowPoints()
On Sun, Jan 15, 2012 at 10:01 AM, Oliver Sims < oliver.s...@simsassociates.co.uk> 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 -- RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2___ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel
Re: [Oorexx-devel] ooDialog - mapWindowPoints()
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:oliver.s...@simsassociates.co.uk] 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:miesf...@gmail.com] 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 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 -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d___ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel