Drag Cursor

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Drag Cursor

Post by nageswaragunupudi »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

I would like to know how to do that too.

James
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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.
Last edited by Antonio Linares on Tue Jan 29, 2008 9:15 am, edited 1 time in total.
regards, saludos

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

Post by Antonio Linares »

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:

Code: Select all

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
Last edited by Antonio Linares on Tue Jan 29, 2008 9:20 am, edited 3 times in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
Last edited by Antonio Linares on Tue Jan 29, 2008 9:24 am, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

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

Code: Select all

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
Post Reply