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

General TRichView support forum. Please post your questions here
Post Reply
Denis Sowa
Posts: 2
Joined: Tue Sep 26, 2006 1:40 pm

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

Post 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.
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post 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
Denis Sowa
Posts: 2
Joined: Tue Sep 26, 2006 1:40 pm

click instead of drag & drop

Post 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.
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply