Thursday 15 January 2015

delphi - Pasting multiple lines into a TEdit -


Regarding a TEdit component, will it be possible to handle multi-line paste from the Windows clipboard for this component? Converting to empty space?

In other words, if the following data was on the Windows clipboard:

  Hello World!   

... and the user pressed their cursor in a TEdit, then pressed CTRL + V, is it possible that TEdit as the input:

You will need the TEdit subclass using an interpozder class , And add a handler for the WM_PASTE message:

  unit unit 3; Interface uses Windows, Messaging, SUsUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StadyCTLL, DB, Adadata, Adfonac, Adstable; Type TEdit = class (StdCtrls.TEdit) process WMPaste (var message: TWMPaste); Message WM_PASTE; End; Type TForm3 = Class (TForm) AdsTable1: TAdsTable; Edit 1: TEdit; Private {Private Announcement} public {public declaration} end; Var form 3: Teform 3; Implementation {$ R *. Dfm} uses the clipboard; {TEdit} process TEdit.WMPaste (var message: TWMPaste); Var tempTxt: string; Start TempTxt: = Clipboard. Acyl; TempTxt: = String Replay (TempTxt, # 13 # 10, # 32, [RF Replace All]); Text: = TempTxt; End; End.    

No comments:

Post a Comment