Вы находитесь на странице: 1из 6

1.

2. -15-08
3. 9
4. 5
5. Paradox 7 .
.
, , .
( , *, , )
6. Paradox 7 BDEAdministrator,
.
7.

8. :

Form1

FormCreate



Table1.Active
True

Delphi7
Vista

9. , :

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










3 ,
1-

10.

/
/
- /
- /
- /
/

()

Filtr

String

boolean

Flag

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('ShifGr').Value;
Form2.Edit2.Text:=Table1.FieldByName('Spec').Value;
Form2.Edit3.Text:=inttoStr(Table1.FieldByName('KStud').Value);
Form2.Edit4.Text:=inttoStr(Table1.FieldByName('SrB').Value);
if Form2.ShowModal=mrOk then
begin
Table1.Edit;
Table1.FieldByName('ShifGr').Value:=Form2.Edit1.Text;
Table1.FieldByName('Spec').Value:=Form2.Edit2.Text;
Table1.FieldByName('KStud').Value:=Form2.Edit3.Text;
Table1.FieldByName('SrB').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;
RadioGroup3: TRadioGroup;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
LabeledEdit1: TLabeledEdit;
LabeledEdit2: TLabeledEdit;
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;
LabeledEdit1.Text:='';
LabeledEdit2.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]+''''+LabeledEdit1.text+''''+' ) ';
LabeledEdit2.Text:=Filtr; Flag:=true; LabeledEdit1.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.