source: tags/1.2.0/Forms/UFormSettings.pas

Last change on this file was 75, checked in by chronos, 8 years ago
  • Fixed: Use option start minimized in system tray only in case of user logon.
File size: 2.0 KB
Line 
1unit UFormSettings;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
9 ULanguages;
10
11type
12
13 { TFormSettings }
14
15 TFormSettings = class(TForm)
16 ButtonOk: TButton;
17 ButtonCancel: TButton;
18 CheckBoxStartMinimizedToTray: TCheckBox;
19 CheckBoxStartOnLogon: TCheckBox;
20 CheckBoxAlwaysOnTop: TCheckBox;
21 ComboBoxLanguage: TComboBox;
22 Label1: TLabel;
23 procedure ButtonOkClick(Sender: TObject);
24 procedure CheckBoxStartOnLogonChange(Sender: TObject);
25 procedure FormShow(Sender: TObject);
26 private
27 { private declarations }
28 public
29 procedure Load;
30 procedure Save;
31 procedure UpdateInterface;
32 end;
33
34var
35 FormSettings: TFormSettings;
36
37implementation
38
39{$R *.lfm}
40
41uses
42 UFormMain;
43
44{ TFormSettings }
45
46procedure TFormSettings.FormShow(Sender: TObject);
47begin
48 FormMain.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
49 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(FormMain.CoolTranslator1.Language);
50 if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
51end;
52
53procedure TFormSettings.ButtonOkClick(Sender: TObject);
54begin
55 if ComboBoxLanguage.ItemIndex <> -1 then
56 FormMain.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
57end;
58
59procedure TFormSettings.CheckBoxStartOnLogonChange(Sender: TObject);
60begin
61 UpdateInterface;
62end;
63
64procedure TFormSettings.Load;
65begin
66 CheckBoxAlwaysOnTop.Checked := FormMain.AlwaysOnTop;
67 CheckBoxStartOnLogon.Checked := FormMain.StartOnLogon;
68 CheckBoxStartMinimizedToTray.Checked := FormMain.StartMinimizedToTray;
69 UpdateInterface;
70end;
71
72procedure TFormSettings.Save;
73begin
74 FormMain.AlwaysOnTop := CheckBoxAlwaysOnTop.Checked;
75 FormMain.StartOnLogon := CheckBoxStartOnLogon.Checked;
76 FormMain.StartMinimizedToTray := CheckBoxStartMinimizedToTray.Checked;
77end;
78
79procedure TFormSettings.UpdateInterface;
80begin
81 CheckBoxStartMinimizedToTray.Enabled := CheckBoxStartOnLogon.Checked;
82end;
83
84end.
85
Note: See TracBrowser for help on using the repository browser.