1

我再次向大家致敬,当然,在编码时遇到了另一个问题。

我写了以下片段:

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 但仍然不成功..

4

1 回答 1

4

只需使用您的 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;
于 2012-12-27T17:41:18.173 回答