Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Accessing text in drag and drop and clipboard in LMDRichEdit demo

I have two questions:

1) I want to test if what is being dragged into LMDRichEdit is text and then process the text (remove line returns and add quotation marks). I'm not sure which event to use with the LMDRichEdit control and how to test that what is dragged is text and then how to process (access) the text.

2) Is there a LMD component that gives me access to the clipboard? I want what I copy from another program (this other program has the focus) to automatically be pasted into a program with LMDRichEdit that doesn't have the focus (and as above I want to process the text before it is automatically pasted into the LMDRichEdit).

Could some one give me a lead on how to do these two things?






  • 4 Comments sorted by Votes Date Added
  • 1.) 
    a.) Within Delphi application:
    Standard drag&Drop methods can be used.
    b.) From different applications: This is not possible in simple way. RichEdit supports by default Drag&Drop from valid sources (e.g. WORD) and there are no events fired (OLE behaviour must be changed then).

    2.) >>Is there a LMD component that gives me access to the clipboard?<<
    For what reason? You can use TClipBoard class to enumerate available formats and to write/read different formats (CF_XXXX). Search google. Examples:
    and so on.

    However I would solve your task differently: Copy RTF content to a stream (use     Editor.CopyToStream), send the stream from one application to another in your preferred method and then paste in target application stream into your richedit control. The runtime demo demonstrate copying text from one RichEdit to another one (without clipoboard) within one application . But technique is the same.
  • Thank you. I will investigate Editor.CopyToStream.

    Regarding number 1: I am not talking about dropping a file but a snippet of text from another source (say a web page--by selecting some text and dragging and dropping it on a program with LMDRichEdit). How do I access that text before dropping it?

  • As I said - there is no direct way (wich RichEdit). This is handled internally using OLE interfaces. You must use some other (OLE-)container.
Sign In or Register to comment.