2 TfmFileFilterEditor = class(TForm)
\r
3 StringGrid1: TStringGrid;
\r
6 procedure Button1Click(Sender: TObject);
\r
7 procedure Button2Click(Sender: TObject);
\r
8 procedure FormActivate(Sender: TObject);
\r
10 { Private declarations }
\r
12 { Public declarations }
\r
14 Constructor Create( AOwner: TComponent ); override;
\r
18 fmFileFilterEditor: TfmFileFilterEditor;
\r
22 Constructor TfmFileFilterEditor.Create( AOwner: TComponent );
\r
29 Caption := 'fmFileFilterEditor' ;
\r
30 Color := clBtnFace ;
\r
31 //Font.Charset := DEFAULT_CHARSET ;
\r
32 Font.Color := clWindowText ;
\r
33 Font.Height := -13 ;
\r
34 Font.Name := 'MS Sans Serif' ;
\r
36 //OldCreateOrder := False ;
\r
38 OnActivate := FormActivate ;
\r
39 StringGrid1 := TStringGrid.Create( Self );
\r
40 StringGrid1.Parent := Self;
\r
41 StringGrid1.Left := 6 ;
\r
42 StringGrid1.Top := 8 ;
\r
43 StringGrid1.Width := 429 ;
\r
44 StringGrid1.Height := 120 ;
\r
45 StringGrid1.ColCount := 2 ;
\r
46 StringGrid1.DefaultColWidth := 204 ;
\r
47 StringGrid1.DefaultRowHeight := 18 ;
\r
48 StringGrid1.FixedCols := 0 ;
\r
49 StringGrid1.RowCount := 50 ;
\r
50 StringGrid1.Options := [ goFixedVertLine, goFixedHorzLine, goVertLine,
\r
51 goHorzLine, goDrawFocusSelected, goRowMoving, goEditing,
\r
52 goAlwaysShowEditor, goThumbTracking];
\r
53 StringGrid1.ScrollBars := ssVertical;
\r
54 StringGrid1.TabOrder := 0 ;
\r
55 Button1 := TButton.Create( Self );
\r
56 Button1.Parent := Self;
\r
57 Button1.Left := 272 ;
\r
58 Button1.Top := 136 ;
\r
59 Button1.Width := 75 ;
\r
60 Button1.Height := 25 ;
\r
61 Button1.Caption := 'OK' ;
\r
62 Button1.OnClick := Button1Click;
\r
63 Button2 := TButton.Create( Self );
\r
64 Button2.Parent := Self;
\r
65 Button2.Left := 360 ;
\r
66 Button2.Top := 136 ;
\r
67 Button2.Width := 75 ;
\r
68 Button2.Height := 25 ;
\r
69 Button2.Caption := 'Cancel' ;
\r
70 Button2.OnClick := Button2Click;
\r
72 StringGrid1.Cols[ 0 ].Text := 'Filter name';
\r
73 StringGrid1.Cols[ 1 ].Text := 'Mask list';
\r
76 procedure TfmFileFilterEditor.Button1Click(Sender: TObject);
\r
81 for I := 1 to StringGrid1.RowCount - 1 do
\r
83 X := StringGrid1.Cells[ 0, I ];
\r
84 Y := StringGrid1.Cells[ 1, I ];
\r
85 if (X = '') and (Y = '') then
\r
87 if Filter <> '' then
\r
88 Filter := Filter + '|';
\r
89 Filter := Filter + X + '|' + Y;
\r
91 ModalResult := mrOK;
\r
94 procedure TfmFileFilterEditor.Button2Click(Sender: TObject);
\r
96 ModalResult := mrCancel;
\r
99 procedure TfmFileFilterEditor.FormActivate(Sender: TObject);
\r
104 while Filter <> '' do
\r
106 I := pos( '|', Filter );
\r
109 X := Copy( Filter, 1, I - 1 );
\r
110 Filter := Copy( Filter, I + 1, MaxInt );
\r
111 I := pos( '|', Filter );
\r
114 Y := Copy( Filter, 1, I - 1 );
\r
115 Filter := Copy( Filter, I + 1, MaxInt );
\r
124 StringGrid1.Cells[ 0, J ] := X;
\r
125 StringGrid1.Cells[ 1, J ] := Y;
\r
127 if StringGrid1.RowCount <= J then
\r
128 StringGrid1.RowCount := J + 1;
\r
130 StringGrid1.RowCount := J + 50;
\r