FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem on Drag 'n' drop with 17.11
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM
Problem on Drag 'n' drop with 17.11
Posted: Wed Dec 06, 2017 10:36 AM
Hello,
My code of drag'n'drop does not working anymore.
I located the problem on this piece of code:
Code (fw): Select all Collapse
METHOD LButtonUp( nRow, nCol, nKeyFlags ) CLASS TControl

   local aPoint := { nRow, nCol }
   local lMoved := .f.

   ::lMouseDown = .f.

   if lDragging
      lDragging = .f.
      ReleaseCapture()

      aPoint = ClientToScreen( ::hWnd, aPoint )
      if aPoint[ 1 ] > 32768
         aPoint[ 1 ] -= 65535
      endif
      if aPoint[ 2 ] > 32768
         aPoint[ 2 ] -= 65535
      endif
      SendMessage( WindowFromPoint( aPoint[ 2 ], aPoint[ 1 ] ),;
                   FM_DROPOVER, nKeyFlags, nMakeLong( nRow, nCol ) )

      return nil
   endif

In the version 15.7 this piece of code was:
Code (fw): Select all Collapse
   if lDragging
      lDragging = .f.
      ReleaseCapture()

      aPoint = ClientToScreen( ::hWnd, aPoint )
      if aPoint[ 1 ] > 32768
         aPoint[ 1 ] -= 65535
      endif
      if aPoint[ 2 ] > 32768
         aPoint[ 2 ] -= 65535
      endif
      SendMessage( WindowFromPoint( aPoint[ 2 ], aPoint[ 1 ] ),;
                   FM_DROPOVER, nKeyFlags, nMakeLong( aPoint[ 1 ], aPoint[ 2 ] ) )

      return nil
   endif

The point passed from screen space to client space, of a unknowed window!

Does anyone remember the motivation of this change?

Personally I think is correct pass the coordinates in screen space...
I think could be usefull pass the origin window too...
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem on Drag 'n' drop with 17.11
Posted: Wed Dec 06, 2017 02:04 PM

Mr Antonio

You made two points:
1) nMakeLong( aPoint[ 1 ], aPoint[ 2 ] ) makes more sense than nMakeLong( nRow, nCol )
and
2) The code in 15.07 used nMakeLong( aPoint[ 1 ], aPoint[ 2 ] ), where as subsequently it was changed to nMakeLong( nRow, nCol )

On the first point, I personally agree with you totally. Yes, that is very useful.
But you are not factually correct on the second point. The code has never been disturbed for many years. I just checked with 12.07.
Probably you might have modified control.prg of 15.07 for your use.

While once again I agree with you on which is better, the sad situation is that we are prevented from making any changes to retain backward compatibility.

Any advice?

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion