Ignore:
Timestamp:
Jun 9, 2011, 1:04:45 PM (13 years ago)
Author:
george
Message:
  • Fixed: Display edit controls according property type.
  • Added: Interface language translation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/USettingForm.pas

    r10 r12  
    66
    77uses
    8   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
     8  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
     9  CoolTranslator, ULanguages;
    910
    1011type
     
    1516    ButtonSave: TButton;
    1617    ButtonCancel: TButton;
     18    ComboBoxLanguage: TComboBox;
    1719    Edit1: TEdit;
    1820    Label1: TLabel;
     21    Label2: TLabel;
     22    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     23    procedure FormShow(Sender: TObject);
    1924  private
    20     { private declarations }
     25    procedure Save;
     26    procedure Load;
    2127  public
    2228    { public declarations }
     
    3036{$R *.lfm}
    3137
     38uses
     39  UCore, UMainForm;
     40
     41{ TSettingForm }
     42
     43procedure TSettingForm.FormShow(Sender: TObject);
     44begin
     45  MainForm.PersistentForm.Load(Self);
     46
     47  Load;
     48end;
     49
     50procedure TSettingForm.FormClose(Sender: TObject; var CloseAction: TCloseAction
     51  );
     52begin
     53  if ModalResult = mrOK then Save;
     54  MainForm.PersistentForm.Save(Self);
     55end;
     56
     57procedure TSettingForm.Save;
     58begin
     59  with Core.CoolTranslator1 do
     60    Language := TLanguage(Languages[ComboBoxLanguage.ItemIndex]);
     61end;
     62
     63procedure TSettingForm.Load;
     64begin
     65  with Core.CoolTranslator1 do begin
     66    LanguageListToStrings(ComboBoxLanguage.Items);
     67    if Assigned(Language) then begin
     68      ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Language);
     69      // Select automatic if no other match
     70      if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
     71    end else ComboBoxLanguage.ItemIndex := 0;
     72  end;
     73end;
     74
    3275end.
    3376
Note: See TracChangeset for help on using the changeset viewer.