Changeset 28 for trunk/Forms/UFormConnect.pas
- Timestamp:
- Sep 10, 2022, 10:21:48 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormConnect.pas
r26 r28 15 15 ButtonOk: TButton; 16 16 ButtonCancel: TButton; 17 ComboBox 1: TComboBox;17 ComboBoxDbEngines: TComboBox; 18 18 EditHost: TEdit; 19 19 EditXml: TEdit; … … 32 32 TabSheetSql: TTabSheet; 33 33 procedure ButtonXmlBrowseClick(Sender: TObject); 34 procedure ComboBox 1Change(Sender: TObject);35 procedure Form Show(Sender: TObject);34 procedure ComboBoxDbEnginesChange(Sender: TObject); 35 procedure FormCreate(Sender: TObject); 36 36 public 37 37 procedure Load(ConnectProfile: TDbConnectProfile); 38 38 procedure Save(ConnectProfile: TDbConnectProfile); 39 procedure Init;39 procedure ReloadDbEngines; 40 40 procedure UpdateInterface; 41 41 end; 42 43 var44 FormConnect: TFormConnect;45 42 46 43 … … 52 49 UCore, UEngineXML, UEngineMySQL; 53 50 51 resourcestring 52 SAnyFile = 'Any file'; 53 SXmlFiles = 'XML files'; 54 54 55 { TFormConnect } 55 56 procedure TFormConnect.FormShow(Sender: TObject);57 begin58 end;59 56 60 57 procedure TFormConnect.ButtonXmlBrowseClick(Sender: TObject); 61 58 begin 62 OpenDialog1.Filter := 'XML files (.xml)|*.xml|Any file|*.*';59 OpenDialog1.Filter := SXmlFiles + ' (.xml)|*.xml|' + SAnyFile + '|*.*'; 63 60 OpenDialog1.InitialDir := ExtractFileDir(EditXml.Text); 64 61 OpenDialog1.FileName := ExtractFileName(EditXml.Text); … … 67 64 end; 68 65 69 procedure TFormConnect.ComboBox 1Change(Sender: TObject);66 procedure TFormConnect.ComboBoxDbEnginesChange(Sender: TObject); 70 67 begin 71 68 UpdateInterface; 69 end; 70 71 procedure TFormConnect.FormCreate(Sender: TObject); 72 begin 73 ReloadDbEngines; 72 74 end; 73 75 … … 76 78 EditName.Text := ConnectProfile.Name; 77 79 //EditConnectionString.Text := Database.ConnectionString; 78 ComboBox 1.ItemIndex := ComboBox1.Items.IndexOfObject(ConnectProfile.ClientType);79 if (ComboBox 1.ItemIndex = -1) and (ComboBox1.Items.Count > 0) then80 ComboBox 1.ItemIndex := 0;80 ComboBoxDbEngines.ItemIndex := ComboBoxDbEngines.Items.IndexOfObject(ConnectProfile.ClientType); 81 if (ComboBoxDbEngines.ItemIndex = -1) and (ComboBoxDbEngines.Items.Count > 0) then 82 ComboBoxDbEngines.ItemIndex := 0; 81 83 if ConnectProfile.Params is TDbConnectParamsXml then 82 84 EditXml.Text := TDbConnectParamsXml(ConnectProfile.Params).FileName; … … 92 94 ConnectProfile.Name := EditName.Text; 93 95 //DatabaseClient.ConnectionString := EditConnectionString.Text; 94 ConnectProfile.ClientType := TDbClientType(ComboBox 1.Items.Objects[ComboBox1.ItemIndex]);96 ConnectProfile.ClientType := TDbClientType(ComboBoxDbEngines.Items.Objects[ComboBoxDbEngines.ItemIndex]); 95 97 if ConnectProfile.Params is TDbConnectParamsXml then 96 98 TDbConnectParamsXml(ConnectProfile.Params).FileName := EditXml.Text; … … 101 103 end; 102 104 103 procedure TFormConnect. Init;105 procedure TFormConnect.ReloadDbEngines; 104 106 var 105 107 I: Integer; 106 108 begin 107 ComboBox1.Items.Clear; 108 for I := 0 to Core.DbManager.ClientTypes.Count - 1 do 109 ComboBox1.Items.AddObject(TDbClientType(Core.DbManager.ClientTypes[I]).Name, 110 Core.DbManager.ClientTypes[I]); 109 ComboBoxDbEngines.Items.BeginUpdate; 110 try 111 ComboBoxDbEngines.Items.Clear; 112 for I := 0 to Core.DbManager.ClientTypes.Count - 1 do 113 ComboBoxDbEngines.Items.AddObject(Core.DbManager.ClientTypes[I].Name, 114 Core.DbManager.ClientTypes[I]); 115 finally 116 ComboBoxDbEngines.Items.Endupdate; 117 end; 111 118 end; 112 119 113 120 procedure TFormConnect.UpdateInterface; 114 121 begin 115 PageControl1.TabIndex := ComboBox 1.ItemIndex;122 PageControl1.TabIndex := ComboBoxDbEngines.ItemIndex; 116 123 end; 117 124
Note:
See TracChangeset
for help on using the changeset viewer.