Смекни!
smekni.com

Облік компютерів та комплектуючих на підприємстві (стр. 7 из 7)

Dialogs, StdCtrls;

type

TForm5 = class(TForm)

Edit1: TEdit;

Button1: TButton;

Button2: TButton;

procedure FormShow(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure Edit1KeyDown(Sender: TObject; var Key: Word;

Shift: TShiftState);

procedure Button1Click(Sender: TObject);

procedure Edit1KeyPress(Sender: TObject; var Key: Char);

procedure Button2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form5: TForm5;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm5.FormShow(Sender: TObject);

begin

Form1.Enabled:=False;

end;

procedure TForm5.FormClose(Sender: TObject; var Action: TCloseAction);

begin

Form1.Enabled:=True;

end;

procedure TForm5.Edit1KeyDown(Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

if Key=27 then Button2.OnClick(Button2); //Вихід

end;

procedure TForm5.Button1Click(Sender: TObject);

var I:Byte;

begin

if Edit1.Text='' then begin

ShowMessage('Назва не може бути пустою!'); Exit;

end;

for i:=0 to Form1.ComboBox1.Items.Count-1 do //Перевірка на наявність відділу

if Edit1.Text=Form1.ComboBox1.Items.Strings[i] then begin

ShowMessage('Такий відділ вже є!'); Exit;

end;

I:=Form1.ComboBox1.ItemIndex+1;

if ((I<1)or(I>Count)) then Exit;

Form1.ComboBox1.Items.Strings[I-1]:=Edit1.Text;

DEP[I].Name:=Edit1.Text;

Form1.ComboBox1.ItemIndex:=I-1;

Editing:=True;

Close;

end;

procedure TForm5.Edit1KeyPress(Sender: TObject; var Key: Char);

begin

if Key=#13 then Button1.OnClick(Button1); //Переіменувати

end;

procedure TForm5.Button2Click(Sender: TObject);

begin

Close;

end;

end.

unit Unit6;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, ComCtrls;

type

TForm6 = class(TForm)

TreeView1: TTreeView;

Memo1: TMemo;

Button1: TButton;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure TreeView1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form6: TForm6;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm6.Button1Click(Sender: TObject);

begin

close;

end;

procedure TForm6.Button2Click(Sender: TObject);

begin

Memo1.Lines.SaveToFile('Справка.FSH');

end;

procedure TForm6.TreeView1Click(Sender: TObject);

begin

Memo1.Lines.LoadFromFile('Справка&bsol;'+TreeView1.Selected.Text+'.FSH');

end;

end.

unit Unit7;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, ExtCtrls;

type

TForm7 = class(TForm)

Panel1: TPanel;

ProgramIcon: TImage;

ProductName: TLabel;

Version: TLabel;

Copyright: TLabel;

OKButton: TButton;

procedure OKButtonClick(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form7: TForm7;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm7.OKButtonClick(Sender: TObject);

begin

close;

end;

end.