Changeset 13 for trunk/Forms/UFormSettings.pas
- Timestamp:
- Oct 5, 2019, 11:16:00 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormSettings.pas
r11 r13 6 6 7 7 uses 8 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls; 8 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls, 9 ULanguages; 9 10 10 11 type … … 15 16 ButtonOk: TButton; 16 17 ButtonCancel: TButton; 18 ComboBoxLanguage: TComboBox; 17 19 Label1: TLabel; 20 Label2: TLabel; 18 21 TrackBar1: TTrackBar; 19 22 procedure ButtonCancelClick(Sender: TObject); 20 23 procedure ButtonOkClick(Sender: TObject); 24 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 25 procedure FormCreate(Sender: TObject); 21 26 procedure FormShow(Sender: TObject); 22 27 private … … 29 34 FormSettings: TFormSettings; 30 35 36 31 37 implementation 32 38 … … 35 41 uses 36 42 UCore; 43 44 resourcestring 45 SLanguageChangeTitle = 'Language change'; 46 SLanguageChangeMessage = 'Interface language was changed. It may require restart of application.'; 47 37 48 38 49 { TFormSettings } … … 46 57 begin 47 58 Core.Game.AnimationDuration := TrackBar1.Position; 59 if ComboBoxLanguage.ItemIndex <> -1 then begin 60 if (Core.Translator1.Language <> TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex])) then 61 MessageDlg(SLanguageChangeTitle, SLanguageChangeMessage, mtInformation, [mbOk], 0); 62 Core.Translator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]); 63 end; 48 64 Close; 65 end; 66 67 procedure TFormSettings.FormClose(Sender: TObject; var CloseAction: TCloseAction 68 ); 69 begin 70 Core.PersistentForm1.Save(Self); 71 end; 72 73 procedure TFormSettings.FormCreate(Sender: TObject); 74 begin 75 Core.Translator1.LanguageListToStrings(ComboBoxLanguage.Items); 49 76 end; 50 77 51 78 procedure TFormSettings.FormShow(Sender: TObject); 52 79 begin 80 Core.PersistentForm1.Load(Self); 53 81 TrackBar1.Position := Core.Game.AnimationDuration; 82 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Translator1.Language); 83 if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0; 54 84 end; 55 85
Note:
See TracChangeset
for help on using the changeset viewer.