简体   繁体   English

Delphi-当用户输入第一个文本时,如何将文本从一个文本复制到另一个文本?

[英]Delphi - How to copy the text from one tedit to another, while the user is typing in the first one?

There are two tedit 有两个

One is enabled for the user, and the other disabled. 一个已为用户启用,另一个已禁用。

The moment user types anything in the tedit, the same thing gets typed in the disabled tedit, while the user is typing. 当用户在tedit中键入任何内容时,在用户键入内容时,将在禁用的tedit中键入相同的内容。

I don't want to use any buttons for this. 我不想为此使用任何按钮。

How to implement this in Delphi? 如何在Delphi中实现呢?

You can use the OnChange event of your first TEdit and set text of the second edit to the text of the first. 您可以使用第一个TEdit的OnChange事件,并将第二个编辑的文本设置为第一个编辑的文本。 This should look like 看起来应该像

procedure TForm1.Edit1Change(Sender: TObject);
begin
  Edit2.Text := Edit1.Text;
end;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM