How to deal with TcxCustomGrid-TcxCustomGrid Drag and Drop when I drag an object to the outside of the window?
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 th开发者_Python百科e line.
I'm using the express quantum grid to implement that.
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
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:
- Raize DropMaster: http://www.raize.com/DevTools/DropMaster/Default.asp
- Anders Melander's Drag and Drop Component Suite: http://melander.dk/delphi/dragdrop
精彩评论