views:

45

answers:

2

I have a TcxGridDBTableView in a window, and dragmode is set to dmAutomatic. When I drag and drop a row above another, it works fine. But when i drag and drop a row to the outside of the window, I'm not getting to the TcxGridDBTableView's 'OnEndDrag' event.

Ex.:

procedure TfrmMyForm.cxGridDBTableViewEndDrag(Sender, Target: TObject; X, Y: Integer);
begin
  ShowMessage('ClassName: ' + Sender.ClassName );
end;

I'm debuggin it, and i have a breakpoint at the showmessage line, but when i drop a row outside of the window, the program dont stop at the line.

I'm using the express quantum grid to implement that.

A: 

Drag / drop to another application (I assume you mean that by "outside of the windows") is not trivial.
The best solution I found is the DragDrop Component Suite of Anders Melander:
http://melander.dk/delphi/dragdrop

Holgerwa
I appreciate the answers. But perhaps my problem is simpler than it appears to be. I just need a flag that notify me if the drag-n-drop has been done successfully. Because i need to undone the changes I make when i start to drag when the 'drop' has not been accepted, for exemple, in the case i drag a row to the outside of the windows application. Sorry for my bad english.
Hrukai Whoever
A: 

Assuming that by "window" you mean the application window, that is because the drag-n-drop implemented by controls is for drag-n-drop within an application only. For drag-n-drop from one application to another, you need to use OLE drag-n-drop. Either implemented yourself (it isn't too hard), or by using a library.

MSDN documentation on OLE drag-n-drop is pretty good. Starting point for reading: Data Transfer (COM)

Two libraries I am aware of:

Marjan Venema
I appreciate the answers. But perhaps my problem is simpler than it appears to be. I just need a flag that notify me if the drag-n-drop has been done successfully. Because i need to undone the changes I make when i start to drag when the 'drop' has not been accepted, for exemple, in the case i drag a row to the outside of the windows application. Sorry for my bad english.
Hrukai Whoever