Board logo

Subject: CnRS232Dialog 可能的 Bug [Print This Page]

Author: Anykey    Time: 2009-5-27 10:45     Subject: CnRS232Dialog 可能的 Bug



QUOTE:


unit CnRS232Dialog;

{ TCnRS232Dlg }
// 窗体创建
procedure TCnRS232Dlg.FormCreate(Sender: TObject);
begin
  FCommConfig := TCnRS232Config.Create;
  FTimeouts := TCnRS232Timeouts.Create;

  //是否应该删除下面两行呢?
  WriteCommConfig;
  WriteCommTimeouts;

end;

不知道是不是我的调用方法不正确,如果不删除这两行,用下面的代码时,设置界面显示的是缺省值:

[Copy to clipboard]
CODE:

  CnRS232.CommName := 'COM1';
  CnRS232.ReadFromIni('.\CommPort.ini', CnRS232.CommName);
  CnRS232Dialog.CommConfig := CnRS232.CommConfig;
  CnRS232Dialog.Timeouts := CnRS232.Timeouts;
  if CnRS232Dialog.Execute then
  begin
    CnRS232.CommConfig := CnRS232Dialog.CommConfig;
    CnRS232.Timeouts := CnRS232Dialog.Timeouts;
  end;
  CnRS232.WriteToIni('.\CommPort.ini', CnRS232.CommName);






Welcome to CnPack Forum (http://bbs.cnpack.org/) Powered by Discuz! 5.0.0