Catching DragDrop when out of the Control

Y

yuval

Hi

DragDrop event is fired by the control accepting the drop

If the drop is performed outside the controls I'm watching with events
(like on another control/panel/window or outside my app) is there a
way for me to know about it? (In MFC, for example, mouse movements are
captured)

Or do I just have to follow DragEnter/DragLeave and deduce from that?
 
O

One Handed Man [ OHM ]

An object is an object isnt it ?, I mean if you want to determine what
object it is, then examin the sender but you will have to enable Drop in any
control you are interested in.

What are you actually trying to acheive ?
 
Y

yuval

When a drag starts inside my app, I turn on a 'bool dragging' flag
that causes the GUI to behave somewhat differently.
For example, when dragging over tree nodes I select the node so the
user gets a visual indication. Usually when the tree node changes
selection, the contents of a ListView changes to show items of the
selected node, but when the 'dragging' flag is on, I dont refresh the
ListView (see Windows Explorer).

In order to reset the flag I need to be notified on the drop. The
problem is that DragDrop events does not fire outside the Controls I'm
watching.
 
1

100

Hi yuval,

When the the source knows when the D&D operation ends. The operation is
finished when DoDragDrop returns. In this very spot of your code (right
after DoDragDrop) you have to reset the flag.
If you need to know how the operations has fnished check DragDropEffects
returned by DoDragDrop methos.
None - operation has been canceled;
Copy - objects has been copied;
Move - obejcts has been moved (you should delete the original one)
Link - the targed has created a link to the object

If you need to know whether the data has been dropped *inside* check the
flag if it is set that means *inside*

Anyway I think the right place to reset the flag is right after the
DoDragDrop call regardless whether data has been dropped *inside* or
*outside*

<<Set the flag>>
DoDragDrop(...)
<<Reset the flag>>

HTH
B\rgds
100


yuval said:
When a drag starts inside my app, I turn on a 'bool dragging' flag
that causes the GUI to behave somewhat differently.
For example, when dragging over tree nodes I select the node so the
user gets a visual indication. Usually when the tree node changes
selection, the contents of a ListView changes to show items of the
selected node, but when the 'dragging' flag is on, I dont refresh the
ListView (see Windows Explorer).

In order to reset the flag I need to be notified on the drop. The
problem is that DragDrop events does not fire outside the Controls I'm
watching.


"One Handed Man [ OHM ]" <terry_burnsREMOVE%FOR%NO%[email protected]>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top