unit Unit1;
interface
uses
System.Classes,
Vcl.Controls,
Vcl.Forms;
type
TADOQuery =
class
end;
TQueryProc = reference
to procedure(aQuery: TADOQuery);
TForm1 =
class(TForm)
procedure FormCreate(Sender: TObject);
private
public
procedure ExecuteSQL1(aQuery: TADOQuery);
procedure ExecuteSQL2(aQuery: TADOQuery);
procedure ExecuteSQL3(aQuery: TADOQuery);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure ShowHourGlassDuringSQL(
const Proc: TQueryProc;
const Query : TADOQuery);
var
OldCursor: TCursor;
begin
OldCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
Proc(
Query);
finally
Screen.Cursor := OldCursor
end;
end;
procedure TForm1.ExecuteSQL1(aQuery: TADOQuery);
begin
end;
procedure TForm1.ExecuteSQL2(aQuery: TADOQuery);
begin
end;
procedure TForm1.ExecuteSQL3(aQuery: TADOQuery);
begin
end;
procedure TForm1.FormCreate(Sender: TObject);
var
LQuery: TADOQuery;
begin
LQuery:= TADOQuery.Create;
ShowHourGlassDuringSQL(ExecuteSQL1, LQuery);
ShowHourGlassDuringSQL(ExecuteSQL2, LQuery);
ShowHourGlassDuringSQL(ExecuteSQL3, LQuery);
end;
end.