Changeset 44 for trunk/Forms


Ignore:
Timestamp:
Mar 9, 2012, 3:02:00 PM (13 years ago)
Author:
chronos
Message:
  • Fixed: Login profile manager can lost some values during edit.
  • Added: Base initialization of TChronisClient.
Location:
trunk/Forms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormLoginProfile.pas

    r43 r44  
    6868    procedure SpinEditPortChange(Sender: TObject);
    6969  private
     70    SelectedProfile: TConnectProfile;
    7071    ProfileList: TProfileList;
    7172  public
    72 
    7373  end;
    7474
     
    128128procedure TLoginProfileForm.ComboBoxProtocolChange(Sender: TObject);
    129129begin
    130   if ListBoxProfiles.ItemIndex <> - 1 then
    131     TConnectProfile(ProfileList[ListBoxProfiles.ItemIndex]).Protocol :=
     130  if Assigned(SelectedProfile) then
     131    SelectedProfile.Protocol :=
    132132      TConnectProtocol(ComboBoxProtocol.Items.Objects[ComboBoxProtocol.ItemIndex]);
    133133end;
     
    135135procedure TLoginProfileForm.EditNameChange(Sender: TObject);
    136136begin
    137   if ListBoxProfiles.ItemIndex <> - 1 then begin
    138     TConnectProfile(ProfileList[ListBoxProfiles.ItemIndex]).Name := EditName.Text;
     137  if Assigned(SelectedProfile) then begin
     138    SelectedProfile.Name := EditName.Text;
    139139    ListBoxProfiles.Items[ListBoxProfiles.ItemIndex] := EditName.Text;
    140140  end;
     
    143143procedure TLoginProfileForm.EditDatabaseChange(Sender: TObject);
    144144begin
    145   if ListBoxProfiles.ItemIndex <> - 1 then
    146     TConnectProfile(ProfileList[ListBoxProfiles.ItemIndex]).Database := EditDatabase.Text;
     145  if Assigned(SelectedProfile) then
     146    SelectedProfile.Database := EditDatabase.Text;
    147147end;
    148148
    149149procedure TLoginProfileForm.EditServerChange(Sender: TObject);
    150150begin
    151   if ListBoxProfiles.ItemIndex <> - 1 then
    152     TConnectProfile(ProfileList[ListBoxProfiles.ItemIndex]).HostName := EditServer.Text;
     151  if Assigned(SelectedProfile) then
     152    SelectedProfile.HostName := EditServer.Text;
    153153end;
    154154
     
    202202  if ListBoxProfiles.ItemIndex <> -1 then
    203203  with TConnectProfile(ProfileList[ListBoxProfiles.ItemIndex]) do begin
     204    SelectedProfile := nil;
    204205    EditServer.Text := HostName;
    205206    EditDatabase.Text := Database;
     
    207208    SpinEditPort.Value := Port;
    208209    EditName.Text := Name;
     210    SelectedProfile := TConnectProfile(ProfileList[ListBoxProfiles.ItemIndex]);
    209211  end;
    210212end;
     
    212214procedure TLoginProfileForm.SpinEditPortChange(Sender: TObject);
    213215begin
    214   if ListBoxProfiles.ItemIndex <> - 1 then
    215     TConnectProfile(ProfileList[ListBoxProfiles.ItemIndex]).Port := SpinEditPort.Value;
     216  if Assigned(SelectedProfile) then
     217    SelectedProfile.Port := SpinEditPort.Value;
    216218end;
    217219
  • trunk/Forms/UFormMain.pas

    r43 r44  
    307307    Core.System.Types.Clear;
    308308    FreeAndNil(Core.Client);
    309     UpdateInterface;
    310   end;
     309    Core.System.Client := Core.Client;
     310  end;
     311  UpdateInterface;
    311312end;
    312313
Note: See TracChangeset for help on using the changeset viewer.