unit DbDatesF;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, StdCtrls, Mask, DBCtrls,
Db, DBTables, ExtCtrls,
Grids, DBGrids, DBCGrids, IBDatabase, IBCustomDataSet, IBTable, IBQuery,
ShellAPI, Menus, ToolWin, ActnMan, ActnCtrls, ActnMenus, ActnColorMaps,
IBStoredProc, ActnList;
type
TForm1 =
class(TForm)
DataSource2: TDataSource;
IBTable1: TIBTable;
IBDatabase1: TIBDatabase;
IBTransaction1: TIBTransaction;
IBQuery1: TIBQuery;
DataSource3: TDataSource;
MainMenu1: TMainMenu;
Datei1: TMenuItem;
Beenden1: TMenuItem;
Beenden2: TMenuItem;
Hilfe1: TMenuItem;
Timer1: TTimer;
Timer2: TTimer;
DataSource1: TDataSource;
IBQuery2: TIBQuery;
Kontakt1: TMenuItem;
Help1: TMenuItem;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
PrintDialog1: TPrintDialog;
DruckerEinstellungen1: TMenuItem;
PrinterSetupDialog1: TPrinterSetupDialog;
PageControl1: TPageControl;
TabSheet2: TTabSheet;
DBGrid2: TDBGrid;
GroupBox2: TGroupBox;
Edit2: TEdit;
TabSheet3: TTabSheet;
DBNavigator1: TDBNavigator;
DBGrid4: TDBGrid;
GroupBox3: TGroupBox;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
DBGrid1: TDBGrid;
DataSource4: TDataSource;
IBQuery3: TIBQuery;
Timer3: TTimer;
Timer4: TTimer;
IBQuery4: TIBQuery;
DataSource5: TDataSource;
DBGrid3: TDBGrid;
Beenden3: TMenuItem;
Label2: TLabel;
Label3: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure ffnen1Click(Sender: TObject);
procedure Speichern1Click(Sender: TObject);
procedure Beenden1Click(Sender: TObject);
procedure Kontakt1Click(Sender: TObject);
procedure Help1Click(Sender: TObject);
procedure DruckerEinstellungen1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure PageControl1Changing(Sender: TObject;
var AllowChange: Boolean);
procedure DBGrid2CellClick(Column: TColumn);
procedure Edit2Change(Sender: TObject);
procedure Timer4Timer(Sender: TObject);
procedure Beenden3Click(Sender: TObject);
procedure Beenden2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses u_hilfe, help;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
IBTable1.Open;
Button2Click(sender);
end;
/////////Button begin/////////////////////////////////////////////////
procedure TForm1.Button1Click(Sender: TObject);
begin
IBTable1.Open;
IBQuery1.SQL.Text:='
select titel,datei from tabelle1 where suchbegriffe like ''
%'+edit2.Text+'
%''
';
IBQuery1.Open;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
timer4.Enabled:=false;
IBQuery4.SQL.Text:='
select titel,datei from tabelle1 where memofeld like ''
%'+edit1.Text+'
%''
';
IBQuery4.Open;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
label2.caption:= IntToStr(IBQuery3.recordcount);
end;
///////Button ende////////////////////////////////////////////
///////Timer begin//////////////////////////////////////////////////
procedure TForm1.Timer1Timer(Sender: TObject);
begin
timer1.Enabled:=false;
IBQuery1.SQL.Text:='
select titel,datei from tabelle1 where suchbegriffe like ''
%'+edit2.Text+'
%''
';
IBQuery1.Open;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
timer3.Enabled:=false;
IBQuery3.SQL.Text:='
select suchbegriffe from tabelle1 where suchbegriffe like ''
%'+edit2.Text+'
%''
';
IBQuery3.Open;
label2.caption:= '
Treffer '+IntToStr(IBQuery3.recordcount);
end;
procedure TForm1.Timer4Timer(Sender: TObject);
begin
timer4.Enabled:=false;
IBQuery4.SQL.Text:='
select titel,datei from tabelle1 where memofeld like ''
%'+edit1.Text+'
%''
';
IBQuery4.Open;
label3.caption:= '
Treffer '+IntToStr(IBQuery4.recordcount)
end;
////////Timer ende/////////////////////////////////////////////
//////Menü begin///////////////////////////////////////////////////
procedure TForm1.ffnen1Click(Sender: TObject);
begin
OpenDialog1.Execute;
end;
procedure TForm1.Speichern1Click(Sender: TObject);
begin
SaveDialog1.Execute;
end;
procedure TForm1.Beenden1Click(Sender: TObject);
begin
PrintDialog1.Execute;
end;
procedure TForm1.DruckerEinstellungen1Click(Sender: TObject);
begin
PrinterSetupDialog1.Execute;
end;
procedure TForm1.Beenden2Click(Sender: TObject);
begin
Application.CreateForm(TForm2,f_help);
f_help.show;
end;
procedure TForm1.Beenden3Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Kontakt1Click(Sender: TObject);
begin
Application.CreateForm(TF_hilfe,f_hilfe);
f_hilfe.showmodal;
F_hilfe.Free;
end;
procedure TForm1.Help1Click(Sender: TObject);
begin
ShellExecute(0,
nil, '
HelpFile.hlp',
nil,
nil, 9);
end;
////////Menü ende//////////////////////////////////////////////////
////////Edits begin//////////////////////////////////////////////
procedure TForm1.Edit1Change(Sender: TObject);
begin
if Edit1.Text <> '
'
then
DBGrid3.Visible:= true
else
DBGrid3.Visible:= false;
timer4.Enabled:=false;
timer4.Enabled:=true;
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
timer1.Enabled:=false;
timer1.Enabled:=true;
timer3.Enabled:=false;
timer3.Enabled:=true;
timer4.Enabled:=false;
timer4.Enabled:=true;
end;
///////Edits ende///////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
procedure TForm1.DBGrid2CellClick(Column: TColumn);
var
s:
string;
x: PAnsiChar;
begin
s:=IBQuery1.FieldByName('
datei').AsString;
x := PChar(s);
if ShellExecute(0,
nil, x,
nil,
nil, 9)< 33
then showmessage('
Anwendung kann nicht geoeffnet werden ');
end;
procedure TForm1.PageControl1Changing(Sender: TObject;
var AllowChange: Boolean);
begin
If (PageControl1.ActivePageIndex = 0)
and (Form2.Edit3.Text <> '
key')
Then AllowChange := False;
end;
end.