Drag 'n' Drop support

Drag 'n' Drop support

Postby AntoninoP » Fri Apr 24, 2015 4:59 pm

Hello,
I am watching the drag'n'drop support in five win and have some notes:
* bDropOver receives the nRow and nCol relatives of sender control
* There is no callback for receiver during mouse move

In my application I am dropping in a list, and I want that the position in the list is based on mouse release position.
I want too draw a line where this new element will be placed.
Now it is not possible.

Regards,
Perry
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: Drag 'n' Drop support

Postby AntoninoP » Wed Apr 29, 2015 10:34 am

Hello,
I modified fiveWin for a IMHO better support for drag'n'drop:

On window.prg
changed
Code: Select all  Expand view
  DATA   bCommNotify, bMenuSelect, bZip, bUnZip, bDropOver

in
Code: Select all  Expand view
  DATA   bCommNotify, bMenuSelect, bZip, bUnZip, bDropOver, bCanDrop, bDropOut


On control.prg
Added:
Code: Select all  Expand view
DATA   oWndOldOver            // DropOver destination window last mousemove

Changed
Code: Select all  Expand view
     SendMessage( WindowFromPoint( aPoint[ 2 ], aPoint[ 1 ] ),;
                   FM_DROPOVER, nKeyFlags, nMakeLong( nRow, nCol ) )

In
Code: Select all  Expand view
     SendMessage( WindowFromPoint( aPoint[ 2 ], aPoint[ 1 ] ),;
                   FM_DROPOVER, nKeyFlags, nMakeLong( aPoint[ 1 ], aPoint[ 2 ] ) )

in this way dropOver receives screen coordinate.
changed
Code: Select all  Expand view
  local nOldRow, nOldCol, hOver, oWndOver, aPoint

in
Code: Select all  Expand view
  local nOldRow, nOldCol, hOver, oWndOver, aPoint, lCanDrop

and
Code: Select all  Expand view
           hOver  = WindowFromPoint( aPoint[ 2 ], aPoint[ 1 ] )

            if hOver == ::hWnd
               SetCursor( ::oDragCursor:hCursor )
            else
               oWndOver = oWndFromHWnd( hOver )
               if oWndOver == nil .or. oWndOver:bDropOver == nil
                  CursorNO()
               else
                  SetCursor( ::oDragCursor:hCursor )
               endif
            endif

in
Code: Select all  Expand view
           hOver  = WindowFromPoint( aPoint[ 2 ], aPoint[ 1 ] )
            oWndOver = nil
            lCanDrop := .T.
            if hOver != ::hWnd
               oWndOver = oWndFromHWnd( hOver )
               if oWndOver == nil .or. ( oWndOver:bCanDrop == nil .and. oWndOver:bDropOver == nil )
                  lCanDrop := .F.
               else
                  if oWndOver:bCanDrop != nil
                     lCanDrop := Eval( oWndOver:bCanDrop, aPoint[1], aPoint[2], nKeyFlags )
                  endif
               endif
            endif
           
            if ::oWndOldOver!=nil .and. hOver != ::oWndOldOver:hWnd .and. ::oWndOldOver:bDropOut != nil
                  Eval( ::oWndOldOver:bDropOut, aPoint[1], aPoint[2], nKeyFlags )
            ENDIF
            ::oWndOldOver := oWndOver
           
            if lCanDrop
               SetCursor( ::oDragCursor:hCursor )
            else
               CursorNO()
            endif


In this way receiver has callbacks: bCanDrop on mouse move and decide if receive or not the callback and bDropOut when dropping going out.
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: Drag 'n' Drop support

Postby Antonio Linares » Wed Apr 29, 2015 1:30 pm

Antonino,

Many thanks!

have you checked if your changes are backwards compatible ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Drag 'n' Drop support

Postby AntoninoP » Wed Apr 29, 2015 4:03 pm

Yes, I tried some samples by fivewin.
When i have time i will post an example with drag'n'drop with listview and insertionMark.
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: Drag 'n' Drop support

Postby nageswaragunupudi » Wed Apr 29, 2015 5:21 pm

Problem is backward compatibility.
All earlier software need to be modified
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10633
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Drag 'n' Drop support

Postby AntoninoP » Thu Apr 30, 2015 7:20 am

Hello,
I removed all my modifications on FiveWin code, put a good drag'n'drop support is too complicated.
In my program I do it in mouse events. In this way I have all control I need,
Regards,
Antonino Perricone
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: Drag 'n' Drop support

Postby Antonio Linares » Thu Apr 30, 2015 7:43 pm

Antonino,

Thanks anyhow :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Drag 'n' Drop support

Postby bpd2000 » Tue Jul 07, 2015 11:18 am

AntoninoP wrote:Yes, I tried some samples by fivewin.
When i have time i will post an example with drag'n'drop with listview and insertionMark.
Regards, Greetings

Try FWH. You will enjoy it's simplicity and power.!
User avatar
bpd2000
 
Posts: 153
Joined: Tue Aug 05, 2014 9:48 am
Location: India


Return to To do - WishList / Por hacer - Peticiones

Who is online

Users browsing this forum: No registered users and 7 guests