簡體   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