source: tags/1.0.0/Forms/UFormImportPattern.pas

Last change on this file was 28, checked in by chronos, 8 years ago
  • Added: Import format items can be repetitive.
  • Added: Show total count of imported items.
  • Added: Button for direct open of import format definition from import source window.
File size: 2.5 KB
Line 
1unit UFormImportPattern;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
9 UAcronym;
10
11type
12
13 { TFormImportPattern }
14
15 TFormImportPattern = class(TForm)
16 ButtonCancel: TButton;
17 ButtonOk: TButton;
18 CheckBoxRepetition: TCheckBox;
19 ComboBoxAction: TComboBox;
20 ComboBoxVariable: TComboBox;
21 EditBlockEnd: TEdit;
22 EditBlockStart: TEdit;
23 Label10: TLabel;
24 Label11: TLabel;
25 Label8: TLabel;
26 Label9: TLabel;
27 procedure FormCreate(Sender: TObject);
28 procedure FormShow(Sender: TObject);
29 private
30 procedure InitControls;
31 public
32 procedure Save(Pattern: TImportPattern);
33 procedure Load(Pattern: TImportPattern);
34 end;
35
36var
37 FormImportPattern: TFormImportPattern;
38
39implementation
40
41{$R *.lfm}
42
43{ TFormImportPattern }
44
45procedure TFormImportPattern.FormShow(Sender: TObject);
46begin
47end;
48
49procedure TFormImportPattern.FormCreate(Sender: TObject);
50begin
51 InitControls;
52end;
53
54procedure TFormImportPattern.InitControls;
55var
56 I: TImportPatternFlag;
57 J: TImportVariable;
58begin
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
66 ComboBoxVariable.Items.Clear;
67 while ComboBoxVariable.Items.Count > 0 do
68 ComboBoxVariable.Items.Delete(ComboBoxVariable.Items.Count - 1);
69 while ComboBoxVariable.Items.Count <= Integer(High(ImportVariableString)) do
70 ComboBoxVariable.Items.Add('');
71 for J := Low(TImportVariable) to High(TImportVariable) do
72 ComboBoxVariable.Items[Integer(J)] := ImportVariableString[J];
73end;
74
75procedure TFormImportPattern.Save(Pattern: TImportPattern);
76begin
77 Pattern.StartString := EditBlockStart.Text;
78 Pattern.EndString := EditBlockEnd.Text;
79 Pattern.Variable := TImportVariable(ComboBoxVariable.ItemIndex);
80 Pattern.Flag := TImportPatternFlag(ComboBoxAction.ItemIndex);
81 Pattern.Repetition := CheckBoxRepetition.Checked;
82end;
83
84procedure TFormImportPattern.Load(Pattern: TImportPattern);
85begin
86 EditBlockStart.Text := Pattern.StartString;
87 EditBlockEnd.Text := Pattern.EndString;
88 ComboBoxVariable.ItemIndex := Integer(Pattern.Variable);
89 ComboBoxAction.ItemIndex := Integer(Pattern.Flag);
90 CheckBoxRepetition.Checked := Pattern.Repetition;
91end;
92
93end.
94
Note: See TracBrowser for help on using the repository browser.