unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, jpeg, ExtCtrls, StdCtrls, ActnList, XPStyleActnCtrls, ActnMan;

type
  TForm3 = class(TForm)
    Image1: TImage;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    ActionManager1: TActionManager;
    Action1: TAction;
    Action2: TAction;
    procedure Action1Execute(Sender: TObject);
    procedure Action2Execute(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm3.Action1Execute(Sender: TObject);
var
fnd:boolean;
i:integer;
begin
fnd:=False;
for i:=0 to Form1.TreeView1.Items.Count-1 do
begin
    if Pos(Edit1.Text,Form1.TreeView1.Items[i].Text)>0 then
    begin
      Form1.TreeView1.Items.Item[i].Selected:=True;
      Form1.TreeView1.SetFocus;
      Form1.TreeView1Click(Sender);
      fnd:=True;
      break;
    end;
    Form3.Close;
end;
if not fnd then
ShowMessage('Запись с таким именем не найдена!');
end;

procedure TForm3.Action2Execute(Sender: TObject);
begin
Form3.Close;
end;

procedure TForm3.Button1Click(Sender: TObject);
var
fnd:boolean;
i:integer;
begin
fnd:=False;
for i:=0 to Form1.TreeView1.Items.Count-1 do
begin
    if Pos(Edit1.Text,Form1.TreeView1.Items[i].Text)>0 then
    begin
      Form1.TreeView1.Items.Item[i].Selected:=True;
      Form1.TreeView1.SetFocus;
      Form1.TreeView1Click(Sender);
      fnd:=True;
      break;
    end;
    Form3.Close;
end;
if not fnd then
ShowMessage('Запись с таким именем не найдена!');
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
Form3.Close;
end;

procedure TForm3.FormActivate(Sender: TObject);
begin
Edit1.Clear;
Edit1.SetFocus;
end;

end.
