unit vladel;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ExtCtrls, StdCtrls, LMDControl, LMDBaseControl,
LMDBaseGraphicButton, LMDCustomSpeedButton, DB, LMDSpeedButton, Buttons;
Продолжение приложения А
type
TFvlad = class(TForm)
Panel1: TPanel;
DBGrid1: TDBGrid;
Panel2: TPanel;
Panel3: TPanel;
RadioGroup1: TRadioGroup;
Edit1: TEdit;
LMDSpeedButton1: TLMDSpeedButton;
Image1: TImage;
RadioGroup2: TRadioGroup;
LMDSpeedButton2: TLMDSpeedButton;
Panel4: TPanel;
Image2: TImage;
Image3: TImage;
LMDSpeedButton4: TLMDSpeedButton;
pedit: TPanel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
LMDSpeedButton8: TLMDSpeedButton;
LMDSpeedButton9: TLMDSpeedButton;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label7: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Image4: TImage;
procedure FormCreate(Sender: TObject);
procedure LMDSpeedButton1Click(Sender: TObject);
procedure LMDSpeedButton2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure LMDSpeedButton8Click(Sender: TObject);
procedure LMDSpeedButton4Click(Sender: TObject);
procedure LMDSpeedButton9Click(Sender: TObject);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
procedure Edit3KeyPress(Sender: TObject; var Key: Char);
procedure Edit4KeyPress(Sender: TObject; var Key: Char);
procedure Edit7KeyPress(Sender: TObject; var Key: Char);
procedure Edit8KeyPress(Sender: TObject; var Key: Char);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Fvlad: TFvlad;
implementation
uses dm;
Продолжение приложения А
{$R *.dfm}
procedure TFvlad.FormCreate(Sender: TObject);
begin
dm1.vlad.IndexName:='FAM';
RadioGroup1.ItemIndex:=-1;
RadioGroup2.ItemIndex:=-1;
end;
procedure TFvlad.LMDSpeedButton1Click(Sender: TObject);
begin
if edit1.Text<>'' then begin
if RadioGroup1.ItemIndex=0 then
if dm1.vlad.Locate('FAM',edit1.Text,[loCaseInsensitive]) then
else MessageBox(Handle,'Нет записи с такой фамилией...','',MB_OK);
if RadioGroup1.ItemIndex=1 then
if dm1.vlad.Locate('TEL',edit1.Text,[loCaseInsensitive]) then
else MessageBox(Handle,'Нет записи с таким телефоном...','',MB_OK);
end
else MessageBox(Handle,'Введите значение для поиска!','',MB_OK);
end;
procedure TFvlad.LMDSpeedButton2Click(Sender: TObject);
begin
if RadioGroup2.ItemIndex=0 then
dm1.vlad.IndexName:='FAM';
if RadioGroup2.ItemIndex=1 then
dm1.vlad.IndexName:='NAME';
if RadioGroup2.ItemIndex=2 then
dm1.vlad.IndexName:='TEL';
end;
procedure TFvlad.FormActivate(Sender: TObject);
begin
pedit.Visible:=true;
pedit.Visible:=false;
end;
procedure TFvlad.LMDSpeedButton8Click(Sender: TObject);
begin
if (Edit5.Text='') or (Edit6.Text='') or (Edit7.Text='')or (Edit8.Text='')
or (Edit2.Text='')or (Edit3.Text='') or (Edit4.Text='')then begin
MessageBox(Handle,'Возможно некоторые поля не заполнены!','Внимание',MB_OK);
exit;
end
else begin
dm1.vlad.Edit;
dm1.vlad.FieldByName('FAM').Value:=edit2.text;
dm1.vlad.FieldByName('NAME').value:=edit3.Text;
dm1.vlad.FieldByName('OTH').value:=edit4.text;
dm1.vlad.FieldByName('ADRES').value:=edit5.text;
dm1.vlad.FieldByName('MAIL').value:=edit6.text;
dm1.vlad.FieldByName('TEL').value:=edit7.text;
dm1.vlad.FieldByName('SOT').value:=edit8.text;
dm1.vlad.Post;
Продолжение приложения А
pedit.Visible:=false;
Edit2.Text:='';
Edit3.Text:='';
Edit4.Text:='';
Edit5.Text:='';
Edit6.Text:='';
Edit7.Text:='';
Edit8.Text:='';
end;
end;
procedure TFvlad.LMDSpeedButton4Click(Sender: TObject);
begin
pedit.Visible:=true;
edit2.text:=dm1.vlad.FieldByName('FAM').Value;
edit3.Text:=dm1.vlad.FieldByName('NAME').value;
edit4.text:=dm1.vlad.FieldByName('OTH').value;
edit5.text:=dm1.vlad.FieldByName('ADRES').value;
edit6.text:=dm1.vlad.FieldByName('MAIL').value;
edit7.text:=dm1.vlad.FieldByName('TEL').value;
edit8.text:=dm1.vlad.FieldByName('SOT').value;
end;
procedure TFvlad.LMDSpeedButton9Click(Sender: TObject);
begin
pedit.Visible:=false;
Edit2.Text:='';
Edit3.Text:='';
Edit4.Text:='';
Edit5.Text:='';
Edit6.Text:='';
Edit7.Text:='';
Edit8.Text:='';
dm1.vlad.Cancel;
end;
procedure TFvlad.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
case key of
'A'..'Z','a'..'z','а'..'я','А'..'Я',#8: key:=key
else key:=#0;
end;
end;
procedure TFvlad.Edit3KeyPress(Sender: TObject; var Key: Char);
begin
case key of
'A'..'Z','a'..'z','а'..'я','А'..'Я',#8: key:=key
else key:=#0;
end;
end;
procedure TFvlad.Edit4KeyPress(Sender: TObject; var Key: Char);
begin
case key of
'A'..'Z','a'..'z','а'..'я','А'..'Я',#8: key:=key
else key:=#0;
end;
end;
Продолжение приложения А
procedure TFvlad.Edit7KeyPress(Sender: TObject; var Key: Char);
begin
case key of
'0'..'9',#8: key:=key
else key:=#0;
end;
end;
procedure TFvlad.Edit8KeyPress(Sender: TObject; var Key: Char);
begin
case key of
'0'..'9',#8: key:=key
else key:=#0;
end;
end;
procedure TFvlad.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Edit1.Text:='';
RadioGroup1.ItemIndex:=-1;
RadioGroup2.ItemIndex:=-1;
close;
end;
end.
Дата: 2019-05-28, просмотров: 167.