Changeset 12 for trunk/Forms/USettingForm.pas
- Timestamp:
- Jun 9, 2011, 1:04:45 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/USettingForm.pas
r10 r12 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 CoolTranslator, ULanguages; 9 10 10 11 type … … 15 16 ButtonSave: TButton; 16 17 ButtonCancel: TButton; 18 ComboBoxLanguage: TComboBox; 17 19 Edit1: TEdit; 18 20 Label1: TLabel; 21 Label2: TLabel; 22 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 23 procedure FormShow(Sender: TObject); 19 24 private 20 { private declarations } 25 procedure Save; 26 procedure Load; 21 27 public 22 28 { public declarations } … … 30 36 {$R *.lfm} 31 37 38 uses 39 UCore, UMainForm; 40 41 { TSettingForm } 42 43 procedure TSettingForm.FormShow(Sender: TObject); 44 begin 45 MainForm.PersistentForm.Load(Self); 46 47 Load; 48 end; 49 50 procedure TSettingForm.FormClose(Sender: TObject; var CloseAction: TCloseAction 51 ); 52 begin 53 if ModalResult = mrOK then Save; 54 MainForm.PersistentForm.Save(Self); 55 end; 56 57 procedure TSettingForm.Save; 58 begin 59 with Core.CoolTranslator1 do 60 Language := TLanguage(Languages[ComboBoxLanguage.ItemIndex]); 61 end; 62 63 procedure TSettingForm.Load; 64 begin 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; 73 end; 74 32 75 end. 33 76
Note:
See TracChangeset
for help on using the changeset viewer.