Finally, with these modifications to MouseMove method of Control.Prg I am able to get what we wanted.
Declare module scope static variable hWndOver
- Code: Select all Expand view RUN
METHOD MouseMove( nRow, nCol, nKeyFlags ) CLASS TControl
local nOldRow, nOldCol
local hOver, oWndOver, aPoint // new locals
< ......... keep the existing code .....>
else
if ::lMouseDown .and. ;
( Abs( nRow - ::nLastRow ) > 5 .or. Abs( nCol - ::nLastCol ) > 5 ) ;
.and. ! Empty( ::oDragCursor )
// SetCursor( ::oDragCursor:hCursor ) // original code commented out
if ! lDragging
::DragBegin( nRow, nCol, nKeyFlags )
// new code begin
hWndOver = ::hWnd
SetCursor( ::oDragCursor:hCursor )
// new code end
else
if ValType( ::bMMoved ) == "B"
Eval( ::bMMoved, nRow, nCol, nKeyFlags, .T. )
endif
endif
// new code begin
DEFAULT hWndOver := ::hWnd
aPoint = { nRow, nCol }
aPoint = ClientToScreen( ::hWnd, aPoint )
hOver := WindowFromPoint( aPoint[ 2 ], aPoint[ 1 ] )
if hOver != hWndOver
hWndOver = hOver
oWndOver = oWndFromHWnd( hOver )
if oWndOver == nil .or. oWndOver:bDropOver == nil
CursorNO()
else
SetCursor( ::oDragCursor:hCursor )
endif
endif
// new code end
else
return Super:MouseMove( nRow, nCol, nKeyFlags )
endif
endif
return 0
//------------
// In this or some other module, preferably in Cursors.c
//
#pragma BEGINDUMP
#include "hbapi.h"
#include <windows.h>
HB_FUNC( CURSORNO )
{
hb_retnl( ( LONG ) SetCursor( LoadCursor( 0, IDC_NO ) ) );
}
#pragma ENDDUMP
Mr Antonio may please see if this seems to be okay.
It is working for me, but I dont know if the code can be improved or can create any unexpected problems.