0

I'm Trying to drag and drop text files into my Delphi app memo1 and load the text. Just like what notepad.exe does ! when dragging any file it loads the text inside of it. but i am trying to only load specified file extension ! to accept loading on memo1.text.

Example: when dragging text.txt file to memo1 it loads the text inside of test.txt but when dragging .exe into memo1 nothing happens or just display error message.

I searched Google and tried my self but i have no answers to my question ;c .

any help will be much appreciated since i got no idea about drag and dropping text into memo.

Michael
  • 41,989
  • 11
  • 82
  • 128
M0HX
  • 31
  • 7
  • hows my question is dupe ;c ? I don't think it duplicated i hope someone answer me guys. – M0HX Oct 05 '14 at 18:22
  • 1
    Use the code in the accepted answer there and implement `DropAllowed` by checking the file extension. Essentially this question merely asks how to implement a drop target. – David Heffernan Oct 05 '14 at 18:52
  • it's just hard ;c could you give me an example. i want just simply drag and drop any file to load in memo1. just usin ondragover and ondragdrop events if possible. I am trying to learn this but i have no idea how – M0HX Oct 05 '14 at 19:33
  • 1
    It sounds as though you aren't experienced enough to code this yourself. In which case a component is useful. Look at the other answers at the dupe. One links to this component: http://melander.dk/delphi/dragdrop – David Heffernan Oct 05 '14 at 19:45
  • I tried this component and it seems not working with xe. I also tried using it with D7 and still the same. BTW I'm using windows8.1 and yep ;c I'm still beginner and can't code it myself hmm ;c. – M0HX Oct 05 '14 at 23:29
  • I guess you need to keep trying – David Heffernan Oct 06 '14 at 06:08
  • That component is supplied with source. You can compile it yourself. This guy documented how to do it for XE2: https://grahamwideman.wikispaces.com/Drag+and+drop+for+Delphi+XE2 – David Heffernan Oct 06 '14 at 08:10

0 Answers0