| 
            Last change
 on this file was             32, checked in by chronos, 16 months ago           | 
        
        
          
            - Modified: Removed U prefix from units names.
 - Modified: Use TFormEx for all forms.
  
           | 
        
        
          | 
            File size:
            1.2 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | unit FormPreferences;
 | 
|---|
| 2 | 
 | 
|---|
| 3 | interface
 | 
|---|
| 4 | 
 | 
|---|
| 5 | uses
 | 
|---|
| 6 |   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
 | 
|---|
| 7 |   DbEngine, FormEx;
 | 
|---|
| 8 | 
 | 
|---|
| 9 | type
 | 
|---|
| 10 |   { TFormPreferences }
 | 
|---|
| 11 | 
 | 
|---|
| 12 |   TFormPreferences = class(TFormEx)
 | 
|---|
| 13 |     ButtonSave: TButton;
 | 
|---|
| 14 |     ButtonCancel: TButton;
 | 
|---|
| 15 |     CheckBoxRememberDatabase: TCheckBox;
 | 
|---|
| 16 |     ComboBoxLanguage: TComboBox;
 | 
|---|
| 17 |     Label1: TLabel;
 | 
|---|
| 18 |   public
 | 
|---|
| 19 |     procedure Load(Preferences: TPreferences);
 | 
|---|
| 20 |     procedure Save(Preferences: TPreferences);
 | 
|---|
| 21 |   end;
 | 
|---|
| 22 | 
 | 
|---|
| 23 | 
 | 
|---|
| 24 | implementation
 | 
|---|
| 25 | 
 | 
|---|
| 26 | {$R *.lfm}
 | 
|---|
| 27 | 
 | 
|---|
| 28 | uses
 | 
|---|
| 29 |   Languages;
 | 
|---|
| 30 | 
 | 
|---|
| 31 | { TFormPreferences }
 | 
|---|
| 32 | 
 | 
|---|
| 33 | procedure TFormPreferences.Load(Preferences: TPreferences);
 | 
|---|
| 34 | begin
 | 
|---|
| 35 |   CheckBoxRememberDatabase.Checked := Preferences.RememberDatabase;
 | 
|---|
| 36 |   TFormEx.Translator.LanguageListToStrings(ComboBoxLanguage.Items);
 | 
|---|
| 37 |   ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(
 | 
|---|
| 38 |     TFormEx.Translator.Language);
 | 
|---|
| 39 |   if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
 | 
|---|
| 40 | end;
 | 
|---|
| 41 | 
 | 
|---|
| 42 | procedure TFormPreferences.Save(Preferences: TPreferences);
 | 
|---|
| 43 | begin
 | 
|---|
| 44 |   Preferences.RememberDatabase := CheckBoxRememberDatabase.Checked;
 | 
|---|
| 45 |   if ComboBoxLanguage.ItemIndex <> -1 then
 | 
|---|
| 46 |     TFormEx.Translator.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
 | 
|---|
| 47 | end;
 | 
|---|
| 48 | 
 | 
|---|
| 49 | end.
 | 
|---|
| 50 | 
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.