You are on page 1of 6

1.

2. -11-08
3. 3
4. 5
5. Paradox 7 . 1-4
. .
,
: ( 1),
( 2), ( 1)
, ( 4).
3 .
, ,
.
3:
1
( ) 2
3
4
1
6.
7.

8. :

Form1

FormCreate



Table1.Active:=True

9. , :

procedure
TForm1.N2Click
procedure
TForm1.N3Click
procedure
TForm1.N4Click
procedure
TForm1.N5Click
procedure
TForm1.N6Click
procedure
TForm2.Button1Click
Procedure
TForm3.FormShow
procedure
TForm3.Button1Click
procedure
TForm3.Button2Click
procedure
TForm3.Button3Click
procedure
TForm3.Button4Click

10.


3 ,
1

/
/
- /
- /
- /
/

()

Filtr

String

Flag

Boolean

11. ,

12.

13. ( .dpr)
14. (.pas)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, DB, DBTables, Grids, DBGrids;
type
TForm1 = class(TForm)
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Table1: TTable;
MainMenu1: TMainMenu;
N1: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N2: TMenuItem;
procedure N2Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2, Unit3, Unit4;
{$R *.dfm}

procedure TForm1.N4Click(Sender: TObject);


begin
If Form2.ShowModal=mrOk then
begin
Table1.Close;
Table1.Open;

Table1.Append;
Table1.FieldByName(' ').Value:=Form2.Edit1.Text;
Table1.FieldByName('').Value:=Form2.Edit2.Text;
Table1.FieldByName(' ').Value:=StrToInt(Form2.Edit3.Text);
Table1.FieldByName(' ').Value:=StrToInt(Form2.Edit4.Text);
Table1.Post;
Table1.Close;
Table1.Open;
end;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
Form2.Caption:=' ';
Form2.Edit1.Text:=Table1.FieldByName('Code_group').Value;
Form2.Edit2.Text:=Table1.FieldByName('Inst').Value;
Form2.Edit3.Text:=inttoStr(Table1.FieldByName('ChisloS').Value);
Form2.Edit4.Text:=inttoStr(Table1.FieldByName('SredVoz').Value);
if Form2.ShowModal=mrOk then
begin
Table1.Edit;
Table1.FieldByName('Code_group').Value:=Form2.Edit1.Text;
Table1.FieldByName('Inst').Value:=Form2.Edit2.Text;
Table1.FieldByName('ChisloS').Value:=Form2.Edit3.Text;
Table1.FieldByName('SredVoz').Value:=Form2.Edit4.Text;
Table1.Post;
Table1.Close;
Table1.Open;
end;
end;
procedure TForm1.N6Click(Sender: TObject);
begin
If MessageDlg('?',mtConfirmation,[mbYes, mbNo],0)=mrYes
then
begin
Table1.Delete;
Table1.Close;
Table1.Open;
end;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
Form3.RadioGroup1.Items:=Table1.FieldList;
if Form3.ShowModal=mrOk then
begin
Form4.Table1.Filtered:=true;
Form4.Table1.Filter:=form3.Filtr;
Form4.Table1.Active:= True;
Form4.ShowModal;
end;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Table1.Active:=true;
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
ModalResult:=mrOk;
end;
end.
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm3 = class(TForm)
RadioGroup1: TRadioGroup;
RadioGroup2: TRadioGroup;
Label1: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label2: TLabel;
RadioGroup3: TRadioGroup;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure FormShow(Sender:TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
Filtr: string;
{ Public declarations }
end;
var
Form3: TForm3;
Flag:boolean;
implementation
uses Unit4, Unit1;
{$R *.dfm}
Procedure TForm3.FormShow(Sender:TObject);
begin
Filtr:='';
Flag:=False;
Edit1.Text:='';
Edit2.Text:='';
RadioGroup1.ItemIndex:=0;
RadioGroup2.ItemIndex:=0;
RadioGroup3.ItemIndex:=0;
end;
procedure TForm3.Button1Click(Sender: TObject);
begin
if flag then With RadioGroup3 do Filtr:=Filtr+Items[ItemIndex];
With RadioGroup1 do Filtr:=Filtr+' ('+Items[ItemIndex]+'';
With RadioGroup2 do Filtr:=Filtr+Items[ItemIndex]+''''+Edit1.text+''''+' ) ';
Edit2.Text:=Filtr; Flag:=true; Edit1.Text:= '';
end;
procedure TForm3.Button3Click(Sender: TObject);
begin
FormShow(Sender);
end;
procedure TForm3.Button2Click(Sender: TObject);
begin

form4.table1.filter := Filtr;
Form4.Table1.Filtered:=true;
Form4.Table1.Active:=true;
form4.show;
end;
procedure TForm3.Button4Click(Sender: TObject);
begin
Form3.Close;
Form1.Show;
end;
end.
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, DBTables;
type
TForm4 = class(TForm)
DataSource1: TDataSource;
Table1: TTable;
DBGrid1: TDBGrid;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
{$R *.dfm}
end.