繁体   English   中英

如何在delphi程序中调用TRichEdit方法

[英]How to call TRichEdit methods inside delphi procedures

当然,我再次向所有人致敬,编码时遇到了另一个问题。

我写了以下代码:

procedure add_text(text : String);
begin
  MsgBox.SetFocus;
  MsgBox.SelStart := MsgBox.GetTextLen;
  MsgBox.Perform(EM_SCROLLCARET, 0, 0);
  MsgBox.SelText := time_stamp + ' ' + text + #13#10; //time_stamp is a function
end;

问题是,如何在程序中访问那些MsgBox的方法? (程序无法编译,因为“未声明的标识符MsgBox”

注意:如果问题不够清楚,请编辑问题。 注2:还尝试使用TChatForm.MsgBox / ChatForm.MsgBox但仍然不成功..

只需使用您的Richedit作为参数调用程序:

procedure add_text(MsgBox:TRichedit;const text : String);
begin
  MsgBox.SetFocus;
  MsgBox.SelStart := MsgBox.GetTextLen;
  MsgBox.Perform(EM_SCROLLCARET, 0, 0);
  MsgBox.SelText := time_stamp + ' ' + text + #13#10; //time_stamp is a function
end;

暂无
暂无

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

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