Бүкіл әлемнің фирмалары мен компаниялары қызметке қажет ақпаратты сақтау және өңдеу үшін компьютерлерді қолданады


ҚОСЫМША Ә Меню қатарын орнату коды



бет25/26
Дата08.06.2022
өлшемі0,55 Mb.
#36560
1   ...   18   19   20   21   22   23   24   25   26
Байланысты:
Delphi joba (1)

ҚОСЫМША Ә
Меню қатарын орнату коды

unit MainUnit;


interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, ExtCtrls, jpeg;
type
TMainForm = class(TForm)
MainMenu1: TMainMenu;
FileMenu: TMenuItem;
BaseMenu: TMenuItem;
N3: TMenuItem;
ExitMenu: TMenuItem;
HelpMenu: TMenuItem;
HisMenu: TMenuItem;
Image1: TImage;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure BaseMenuClick(Sender: TObject);
procedure ExitMenuClick(Sender: TObject);
procedure HisMenuClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
uses BaseUnit, HelpUnit, PasUnit;
{$R *.dfm}
procedure TMainForm.Button2Click(Sender: TObject);
begin
BaseForm.ShowModal;
end;
procedure TMainForm.Button3Click(Sender: TObject);
begin
HelpForm.ShowModal;
end;
procedure TMainForm.BaseMenuClick(Sender: TObject);
begin
BaseForm.ShowModal;
end;
procedure TMainForm.ExitMenuClick(Sender: TObject);
begin
Close;
end;
procedure TMainForm.HisMenuClick(Sender: TObject);
begin
HelpForm.ShowModal;
end;
end.
ҚОСЫМША Б
Мәліметтерді ұйымдастыратын және құратын код.

unit BaseUnit;


interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, Db, DBTables, ExtCtrls, DBCtrls, StdCtrls;
type
TBaseForm = class(TForm)
Table1: TTable;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
DBText1: TDBText;
Button1: TButton;
Query1: TQuery;
Button3: TButton;
RadioGroup1: TRadioGroup;
CheckBox1: TCheckBox;
Edit2: TEdit;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Button4: TButton;
Button5: TButton;
ListBox1: TListBox;
Label1: TLabel;
Label2: TLabel;
Bevel1: TBevel;
Bevel2: TBevel;
procedure Button1Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure ComboBox2KeyPress(Sender: TObject; var Key: Char);
procedure Button5Click(Sender: TObject);

private
{ Private declarations }


public
{ Public declarations }
end;
var
BaseForm: TBaseForm;
implementation
uses MainUnit;
{$R *.DFM}
procedure TBaseForm.Button1Click(Sender: TObject);
var
ozenka: string[50];
begin
ozenka:=InputBox('МК-нан акпарат танда',
'Улгеримін корсетінізде OK-дi басыныз.', '*');
if ozenka<> '*'
then
begin
with BaseForm.Query1 do begin
Close;
SQL.Clear;
SQL.Add('SELECTFam,Name,Surname,Birthday,Education, Ozenka,Adress,country');
SQL.Add('FROM ":STANDARD2:tab.db"');
SQL.Add('WHERE');
SQL.Add('(ozenka = "'+ ozenka+ '")');
SQL.Add('ORDER BY Fam,Name,Country,ozenka');
Open;
end;
if Query1.RecordCount <> 0 then
DataSource1.DataSet:=Query1
else begin
ShowMessage('Берiлген сураныс МК канагаттандырмайды.');
DataSource1.DataSet:=Table1;
end;
end;
end;
procedure TBaseForm.FormActivate(Sender: TObject);
begin
with Session do
begin
ConfigMode:=cmSession;
try
AddStandardAlias('STANDARD2',
ExtractFilePath(ParamStr(0))+'Basa\’
'PARADOX');
Table1.Active:=True;
Finally
ConfigMode:=cmAll;
end;
end;
end;
procedure TBaseForm.Button3Click(Sender: TObject);
begin
close;
end;
procedure TBaseForm.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked=true
then
begin
CheckBox1.Caption:='Iздеу режимi косулы';
Edit2.SetFocus;
end
else CheckBox1.Caption:='Iздеу режимi сонiулi';
end;
procedure TBaseForm.Edit2Change(Sender: TObject);
var
strField:string;
begin
if not CheckBox1.Checked then Exit;
case RadioGroup1.ItemIndex of
0: strField:='Fam';
1: strField:='Name';
2: strField:='Country';
end;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select * from tab.db where '+strField+' LIKE "'+Edit2.Text+'%"');
Query1.Open;
Query1.FieldByName('Fam').DisplayLabel:='Фамилия';
Query1.FieldByName('Name').DisplayLabel:='Аты';
Query1.FieldByName('Surname').DisplayLabel:='Теги';
Query1.FieldByName('Birthday').DisplayLabel:='Туган куни';
Query1.FieldByName('Education').DisplayLabel:='Оку тури';
Query1.FieldByName('Ozenka').DisplayLabel:='Улгерими';
Query1.FieldByName('Adress').DisplayLabel:='Мекен-жайы';
end;
procedure TBaseForm.FormCreate(Sender: TObject);
begin
Application.Title:='Студенттердiн малиметтер коры';
DataSource1.DataSet:=Query1;
DBGrid1.DataSource:=DataSource1;
end;
procedure TBaseForm.Button4Click(Sender: TObject);
var
i: integer;
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select '+ComboBox1.Text+
' from tab.db '+'Order by '+ComboBox2.Text);
Query1.Open;
try
if ComboBox1.Text='*' then
begin
Query1.FieldByName('fam').DisplayLabel:='фамилия';
Query1.FieldByName('name').DisplayLabel:='аты';
Query1.FieldByName('surname').DisplayLabel:='тегi';
Query1.FieldByName('birthday').DisplayLabel:='туган кунi';
Query1.FieldByName('country').DisplayLabel:='туган жерi';
Query1.FieldByName('education').DisplayLabel:='оку турi';
Query1.FieldByName('ozenka').DisplayLabel:='улгерiмi';
Query1.FieldByName('adress').DisplayLabel:='мекен-жайы';
end
else
begin
for i:=0 to ComboBox1.Items.Count-1 do
if ComboBox2.Text=ComboBox1.Items.Strings[i]
then Query1.FieldByName(ComboBox2.Text).
DisplayLabel:=ListBox1.Items.Strings[i-1];
end;
except
end;
ComboBox1.Items.Clear;
ComboBox1.Items.Add('*');
for i:=0 to Query1.FieldCount-1 do
ComboBox1.Items.Add(Query1.Fields.Fields[i].FieldName);
ComboBox2.Items.Clear;
for i:=0 to Query1.FieldCount-1 do
ComboBox2.Items.Add(Query1.Fields.Fields[i].FieldName);
ComboBox1.Enabled:=true;
ComboBox2.Enabled:=true;
Button5.Enabled:=true;
end;
procedure TBaseForm.ComboBox1Change(Sender: TObject);
begin
if ComboBox1.Text<>'*'
then
begin
ComboBox2.Enabled:=false;
ComboBox2.Text:=ComboBox1.Text;
end
else ComboBox2.Enabled:=true;
end;
procedure TBaseForm.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
Button4.Click;
end;
end;
procedure TBaseForm.ComboBox2KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
Key:=#0;
Button4.Click;
end;
end;
procedure TBaseForm.Button5Click(Sender: TObject);
var
i: integer;
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select * from tab.db Order by Fam');
Query1.Open;
try
Query1.FieldByName('fam').DisplayLabel:='фамилия';
Query1.FieldByName('name').DisplayLabel:='аты';
Query1.FieldByName('surname').DisplayLabel:='тегi';
Query1.FieldByName('birthday').DisplayLabel:='туган кунi';
Query1.FieldByName('country').DisplayLabel:='туган жерi';
Query1.FieldByName('education').DisplayLabel:='оку турi';
Query1.FieldByName('ozenka').DisplayLabel:='улгерiмi';
Query1.FieldByName('adress').DisplayLabel:='мекен-жайы';
except
end;
ComboBox1.Items.Clear;
ComboBox1.Text:='*';
ComboBox1.Items.Add('*');
for i:=0 to Query1.FieldCount-1 do
ComboBox1.Items.Add(Query1.Fields.Fields[i].FieldName);
ComboBox2.Items.Clear;
ComboBox2.Text:='fam';
for i:=0 to Query1.FieldCount-1 do
ComboBox2.Items.Add(Query1.Fields.Fields[i].FieldName);
Edit2.Text:='';
end;
end.


Достарыңызбен бөлісу:
1   ...   18   19   20   21   22   23   24   25   26




©emirsaba.org 2024
әкімшілігінің қараңыз

    Басты бет