Forum > General

How to use drag&drop on TRICHMEMO ?

(1/1)

docno:
Hello,
I want to use drag&drop on richmemo control.
I want open a file (text file) dropped from explorer in my richmemo.

When i drop something on richmemo i cant have any event fired and an icon is show in editor.
I cant have filename.
No event ondragdrop or ondragover or enddrag...

Any clue ?

I work on windows 10 x64 with lazarus 3.4

rvk:
For the standard RichEdit dll you would need to pass ES_NOOLEDRAGDROP to disable OLE drag and drop, when creating the richedit window.
After that you would be able to use the normal Lazarus component events.

Normally you could do that by overriding the CreateParams and changing the Params.Style (adding ES_NOOLEDRAGDROP) before creation of the TRichMemo.

But because of the way Lazarus uses widget factoring code (for multi platform), you don't have easy control over these parameters.

At least as I can see the component is created in TWin32WSCustomRichMemo.CreateHandle and the parameters can't be easily manipulated there.

Maybe someone with knowledge about the widget construct can help here.

The way TJVRichEdit does it in Delphi is here https://github.com/project-jedi/jvcl/blob/master/jvcl/run/JvRichEdit.pas.
(search for OLEDragDrop)

Dzandaa:
Hi,
Here is an example of Drag and Drop with a TImage and a TRichMemo

If you drag your a rtf File directly on the TRichMemo, it insert the Icon of the file, if you Drag a rtf (or picture) on the Form,
it add the rtf (or picture) to TRichMemo or TImage. 

Hope that help.

B->

Navigation

[0] Message Index

Go to full version