Page 1 of 1

Build in Drag&Drop + Delphi Drag&Drop to ComboBox

Posted: Tue Sep 26, 2006 9:41 pm
by Denis Sowa
hi, i need help on implementing drag&drop from trichviewedit to comboxbox component. but i don't want to lose the build in drag&drop functions like moving text around.

Posted: Thu Sep 28, 2006 9:49 pm
by shmp
Try creating a global virable, say, 'dragtext'. Select the text in rve. OnMouseDown, if selected item is text then copy selected text to 'dragtext', and onCombobox mousedown if 'dragtext' is empty then do nothing else paste 'dragtext' into combobox. After drop clear dragtext.

How about that?

Henry

click instead of drag & drop

Posted: Thu Sep 28, 2006 10:09 pm
by Denis Sowa
no this is not enough.
i want real drag & drop. if i set dragmode to auto. the whole think is working. but then the trichview build in drag & drop feature is disabled. and i can't no longer drag to a textfile, the internetexplorer and so on.
so it must be possible to register the combobox to receive the drag & drop also.

Posted: Sat Sep 30, 2006 4:26 am
by shmp
Now I think I see your problem. There was a sample on draging gif image from a browser, like Internet Explorer, into rve and yes it needs to be registered. I managed to make it work.

I just wondered if combo box would be much easier because there are lots of combo box version?

Sorry I have not attempted to solve this problem before.

Henry.

Posted: Sat Sep 30, 2006 7:21 pm
by Sergey Tkachenko
There are two types of drag&drop possible in Delphi applications:
1) VCL d&d (DragMode, OnStartDrag, OnDragOver, OnDragDrop). It can be used to drag VCL control to another VCL control;
2) System (OLE) d&d. Used by TRichView; can be used to drag data of different formats even between applications.

To accept TRichView data, you need to implement a drag target.
It's not a trivial task if you did not do it before. Fortunately, there is Drag and Drop Component Suite (freeware): http://www.torry.net/vcl/system/dragand ... agdrop.exe
This demo shows how to use it to make TPanel accept data from TRichView:
http://www.trichview.com/support/files/rvftarget.zip
I hope it will work for TComboBox without significant changes.