source: trunk/Forms/FormImportPattern.pas

Last change on this file was 221, checked in by chronos, 4 days ago
  • Fixed: Use scrollbox in resizable forms.
  • Fixed: Translate all forms.
File size: 2.6 KB
Line 
1unit FormImportPattern;
2
3interface
4
5uses
6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
7 Acronym, FormEx;
8
9type
10
11 { TFormImportPattern }
12
13 TFormImportPattern = class(TFormEx)
14 ButtonCancel: TButton;
15 ButtonOk: TButton;
16 CheckBoxRepetition: TCheckBox;
17 ComboBoxAction: TComboBox;
18 ComboBoxVariable: TComboBox;
19 EditBlockEnd: TEdit;
20 EditBlockStart: TEdit;
21 Label10: TLabel;
22 Label11: TLabel;
23 Label8: TLabel;
24 Label9: TLabel;
25 ScrollBox1: TScrollBox;
26 procedure FormCreate(Sender: TObject);
27 procedure FormShow(Sender: TObject);
28 private
29 procedure InitControls;
30 public
31 procedure Save(Pattern: TImportPattern);
32 procedure Load(Pattern: TImportPattern);
33 end;
34
35
36implementation
37
38{$R *.lfm}
39
40{ TFormImportPattern }
41
42procedure TFormImportPattern.FormShow(Sender: TObject);
43begin
44 InitControls;
45end;
46
47procedure TFormImportPattern.FormCreate(Sender: TObject);
48begin
49 InitControls;
50end;
51
52procedure TFormImportPattern.InitControls;
53var
54 I: TImportPatternFlag;
55 J: TImportVariable;
56 Index: Integer;
57begin
58 Index := ComboBoxAction.ItemIndex;
59 while ComboBoxAction.Items.Count > 0 do
60 ComboBoxAction.Items.Delete(ComboBoxAction.Items.Count - 1);
61 while ComboBoxAction.Items.Count <= Integer(High(ImportPatternFlagString)) do
62 ComboBoxAction.Items.Add('');
63 for I := Low(TImportPatternFlag) to High(TImportPatternFlag) do
64 ComboBoxAction.Items[Integer(I)] := ImportPatternFlagString[I];
65 ComboBoxAction.ItemIndex := Index;
66
67 Index := ComboBoxVariable.ItemIndex;
68 ComboBoxVariable.Items.Clear;
69 while ComboBoxVariable.Items.Count > 0 do
70 ComboBoxVariable.Items.Delete(ComboBoxVariable.Items.Count - 1);
71 while ComboBoxVariable.Items.Count <= Integer(High(ImportVariableString)) do
72 ComboBoxVariable.Items.Add('');
73 for J := Low(TImportVariable) to High(TImportVariable) do
74 ComboBoxVariable.Items[Integer(J)] := ImportVariableString[J];
75 ComboBoxVariable.ItemIndex := Index;
76end;
77
78procedure TFormImportPattern.Save(Pattern: TImportPattern);
79begin
80 Pattern.StartString := EditBlockStart.Text;
81 Pattern.EndString := EditBlockEnd.Text;
82 Pattern.Variable := TImportVariable(ComboBoxVariable.ItemIndex);
83 Pattern.Flag := TImportPatternFlag(ComboBoxAction.ItemIndex);
84 Pattern.Repetition := CheckBoxRepetition.Checked;
85end;
86
87procedure TFormImportPattern.Load(Pattern: TImportPattern);
88begin
89 EditBlockStart.Text := Pattern.StartString;
90 EditBlockEnd.Text := Pattern.EndString;
91 ComboBoxVariable.ItemIndex := Integer(Pattern.Variable);
92 ComboBoxAction.ItemIndex := Integer(Pattern.Flag);
93 CheckBoxRepetition.Checked := Pattern.Repetition;
94end;
95
96end.
97
Note: See TracBrowser for help on using the repository browser.