ConnectDlg.pas
上传用户:llfxmlw
上传日期:2009-09-14
资源大小:335k
文件大小:2k
- unit ConnectDlg;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- FormSettings, StdCtrls, Buttons, Registry;
- type
- TClientConnectForm = class(TForm)
- Label1: TLabel;
- Label2: TLabel;
- PortEdit: TEdit;
- ConnectBut: TBitBtn;
- CancelBut: TBitBtn;
- FormSettings1: TFormSettings;
- ServerCombo: TComboBox;
- Label3: TLabel;
- PassEdit: TEdit;
- StartScreenBox: TCheckBox;
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure FormShow(Sender: TObject);
- private
- { Private declarations }
- procedure LoadCombo;
- procedure SaveCombo;
- public
- { Public declarations }
- end;
- var
- ClientConnectForm: TClientConnectForm;
- implementation
- {$R *.DFM}
- procedure TClientConnectForm.FormClose(Sender: TObject;
- var Action: TCloseAction);
- var
- s : string;
- i : integer;
- begin
- s := ServerCombo.Text;
- i := ServerCombo.Items.IndexOf(s);
- if i <> -1 then ServerCombo.Items.Delete(i);
- ServerCombo.Items.Insert(0, s);
- while ServerCombo.Items.Count > 8 do
- ServerCombo.Items.Delete(8);
- ServerCombo.Text := s;
- SaveCombo;
- FormSettings1.SaveSettings;
- end;
- procedure TClientConnectForm.FormShow(Sender: TObject);
- begin
- LoadCombo;
- ServerCombo.SetFocus;
- end;
- procedure TClientConnectForm.LoadCombo;
- var
- ini : TRegIniFile;
- begin
- ini := TRegIniFile.Create('Software' + Application.Title);
- ServerCombo.Items.CommaText := ini.ReadString('Servers', 'ServerCombo', '');
- ServerCombo.ItemIndex := 0;
- ini.Free;
- end;
- procedure TClientConnectForm.SaveCombo;
- var
- ini : TRegIniFile;
- begin
- ini := TRegIniFile.Create('Software' + Application.Title);
- ini.WriteString('Servers', 'ServerCombo', ServerCombo.Items.CommaText);
- ini.Free;
- end;
- end.