FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Drag Cursor
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Drag Cursor
Posted: Mon Jan 28, 2008 03:07 AM

In many other applications we see that when a drag cursor is moved over a window ( or control ) that does not accept the drop, the cursor changes as circle with a line inside. The user knows that this control does not accept the drop. Only the window ( control ) which accepts the drop shows the drag cursor in its original shape.

In the programs we develop with FW, the drag cursor looks the same even when it is moved over windows ( controls ) which do not accept drop. ( bDropOver data is nil ).

Is it possible for the Window class's method MouseMove examines the cursor, and if it is a drag cursor originating from some other control, and if the window's bDropOver is nil, to change the shape of cursor to the Circle with Dash cursor ?

Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Drag Cursor
Posted: Tue Jan 29, 2008 12:50 AM

I would like to know how to do that too.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Drag Cursor
Posted: Tue Jan 29, 2008 09:10 AM

We could control that behavior from the MouseMove() method.

We need to check the object that it is below the mouse, and if it is a FWH object, and then check its bDropOver codeblock contents.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Drag Cursor
Posted: Tue Jan 29, 2008 09:12 AM
To locate the control that it is under the mouse we can use WindowFromPoint()

To check if it is a FWH object, we can use:
hWndCtl = WindowFromPoint( nRow, nCol )

if oWndFromHwnd( hWndCtl ) != nil .and. oWndFromHwnd( hWndCtl ):bDragOver != nil
   SetCursor( ... )
else
   SetCursor( ... )
endif

We could modify METHOD MouseMove( nRow, nCol, nKeyFlags ) CLASS TControl if we want to turn it a standard behavior
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Drag Cursor
Posted: Tue Jan 29, 2008 09:13 AM

Yes it is not simple. That is why we need Mr Antonio. He only can make difficult things easy for us.

:)

Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Drag Cursor
Posted: Tue Jan 29, 2008 09:19 AM

I'm thinking that there must be a Windows API for this since other programs (like Windows Explorer) can communicate with other programs when dragging the cusor because it changes depending on which program the drag cursor is over. When I dragged it over one program it changed to a link icon, and then over another program and it changed to a black circle containing a slash.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Drag Cursor
Posted: Tue Jan 29, 2008 09:19 AM

Isn't the change in the shape of drag cursor a native behaviour of windows? Dont think all windows are programmed to change the shape. Just a thought.

Regards



G. N. Rao.

Hyderabad, India
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Drag Cursor
Posted: Tue Jan 29, 2008 09:22 AM

James, Nageswararao,

FWH does not use the standard Windows API for such conversation. We did it that way to have full control on it (as we may need to drop "non standard" Windows contents, as Harbour objects, codeblocks, etc.).

But, on the other hand, we can't drop on non FWH apps cause that :-(

Maybe we should combine both methods

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Drag Cursor
Posted: Tue Jan 29, 2008 09:24 AM

NageswaraRao,

>Isn't the change in the shape of drag cursor a native behaviour of windows? Dont think all windows are programmed to change the shape.

I'm not sure what you mean?

I dragged a file from Windows Explorer over IE (FiveWin Forum) and it changed to a link icon, then over an email monitoring program and it changed to the circle/slash. The first two are Microsft programs, but the last one isn't.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Drag Cursor
Posted: Tue Jan 29, 2008 09:26 AM

Antonio,

>But, on the other hand, we can't drop on non FWH apps cause that.

I don't understand. We can't because of what? It would be useful if we could drop on non FWH apps.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Drag Cursor
Posted: Tue Jan 29, 2008 09:26 AM

Mr. James

I meant the same thing as you. I didn't explain it well. That's all
I agree with your earlier post.

Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Drag Cursor
Posted: Tue Jan 29, 2008 09:28 AM

Antonio,

Opps. I misread your previous message. I thought you said you WERE using the Windows API, not that you weren't using it.

Now I understand.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Drag Cursor
Posted: Tue Jan 29, 2008 09:30 AM

Mr Antonio

We agree with you that it is FW's own implementation. Now we need further improvisation, whenever you find time. No hurry.

In our own applications we need to make clear to the user where he can drop and where can not.

Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Drag Cursor
Posted: Tue Jan 29, 2008 09:37 AM

Yes, I am not in a hurry either. Drag & drop is nice to have, but not a requirement. Lots of users never even discover it.

I did build a prototype app that makes use of D&D and it seems to be quite useful to me. But, I know how to use it, so I know where I can drop and where I can't. So, visual "hinting" would be a nice addition.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Drag Cursor
Posted: Tue Jan 29, 2008 12:42 PM
Mr Antonio

Here is a suggestion.

At the outset, when the first window is created a NoDropCursor is created either as static variable or class variable in the Window.prg. At the end of the application this cursor is destroyed. Assuming this is done, I suggest the following modification to the MoveMove method of Window.Prg


METHOD MouseMove( nRow, nCol, nKeyFlags ) CLASS TWindow

/*
   // original code

   if ::oCursor != nil
      SetCursor( ::oCursor:hCursor )
   else
      CursorArrow()
   endif
*/


   // Proposed Code

   if uDropInto != nil .and. ::bDropOver == nil .and. ::bDropFiles == nil
      SetCursor( oNoDropCursor:hCusor )
   elseif ::oCursor != nil
      SetCursor( ::oCursor:hCursor )
   else
      CursorArrow()
   endif


Please review.
Regards



G. N. Rao.

Hyderabad, India