Drag Cursor

Drag Cursor

Postby nageswaragunupudi » Mon Jan 28, 2008 3: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
User avatar
nageswaragunupudi
 
Posts: 10645
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby James Bott » Tue Jan 29, 2008 12:50 am

I would like to know how to do that too.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Tue Jan 29, 2008 9: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.
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: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Tue Jan 29, 2008 9: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:
Code: Select all  Expand view  RUN
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
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby nageswaragunupudi » Tue Jan 29, 2008 9: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
User avatar
nageswaragunupudi
 
Posts: 10645
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby James Bott » Tue Jan 29, 2008 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby nageswaragunupudi » Tue Jan 29, 2008 9: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
User avatar
nageswaragunupudi
 
Posts: 10645
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Antonio Linares » Tue Jan 29, 2008 9: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
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
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Tue Jan 29, 2008 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby James Bott » Tue Jan 29, 2008 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby nageswaragunupudi » Tue Jan 29, 2008 9: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
User avatar
nageswaragunupudi
 
Posts: 10645
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby James Bott » Tue Jan 29, 2008 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby nageswaragunupudi » Tue Jan 29, 2008 9: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
User avatar
nageswaragunupudi
 
Posts: 10645
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby James Bott » Tue Jan 29, 2008 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby nageswaragunupudi » 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


Code: Select all  Expand view  RUN
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
User avatar
nageswaragunupudi
 
Posts: 10645
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 54 guests