unit UNew;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs, Data.DB, MemDS, DBAccess, Ora,
Vcl.StdCtrls, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
cxContainer, cxEdit, cxListBox, cxDBEdit, cxTextEdit, cxMaskEdit,
cxDropDownEdit, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox, cxStyles,
cxCustomData, cxFilter, cxData, cxDataStorage, cxDBData,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
cxClasses, cxGridCustomView, cxGrid;
type
// TInstError = procedure(const Content: String) of object;
TFrmNew =
class(TForm)
OraSession: TOraSession;
fncsleep: TOraStoredProc;
lbl_oraconnect: TLabel;
lbl_orasleep: TLabel;
lbl_3: TLabel;
lbl_FormName: TLabel;
lbl1: TLabel;
lbl_FormTag: TLabel;
OraSessCommon: TOraSession;
Ds_searchMA: TOraDataSource;
qry_searchMA: TOraQuery;
qry_searchMAPER_PK: TIntegerField;
qry_searchMAPER_STRORALOGIN: TStringField;
qry_searchMAPER_STRFIRSTNAME: TStringField;
qry_searchMAPER_STRLASTNAME: TStringField;
qry_searchMAPER_BOLACTIVE: TIntegerField;
qry_searchMAPER_STRPERNO: TStringField;
cbb1: TcxLookupComboBox;
btn_telechild: TButton;
cxgrdbtblvwGrid1DBTableView1: TcxGridDBTableView;
cxgrdlvlGrid1Level1: TcxGridLevel;
cxgrd1: TcxGrid;
cxgrdbclmnGrid1DBTableView1PER_PK: TcxGridDBColumn;
cxgrdbclmnGrid1DBTableView1PER_STRORALOGIN: TcxGridDBColumn;
cxgrdbclmnGrid1DBTableView1PER_STRFIRSTNAME: TcxGridDBColumn;
cxgrdbclmnGrid1DBTableView1PER_STRLASTNAME: TcxGridDBColumn;
cxgrdbclmnGrid1DBTableView1PER_BOLACTIVE: TcxGridDBColumn;
cxgrdbclmnGrid1DBTableView1PER_STRPERNO: TcxGridDBColumn;
mmo1: TMemo;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
function update : Boolean;
procedure btn_telechildClick(Sender: TObject);
procedure qry_searchMAAfterScroll(DataSet: TDataSet);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
protected
procedure CreateParams(
var Params: TCreateParams);
override;
end;
TMyThread =
class(TThread)
private
// FInstError: TInstError;
procedure execute;
override;
procedure doprogress;
public
//
protected
FormUsed : TFrmNew;
//property InstError: TInstError read FInstError write FInstError;
end;
var
Fname :
string;
MThread : TMyThread;
progressvar : SmallInt = 0;
orasessioninprogress : Boolean = False;
implementation
{$R *.dfm}
uses UMain;
procedure TFrmNew.btn_telechildClick(Sender: TObject);
begin
FrmMain.btn_telemainClick(sender);
end;
procedure TFrmNew.CreateParams(
var Params: TCreateParams);
begin
inherited;
Params.ExStyle := Params.ExStyle
or WS_EX_APPWINDOW;
end;
function TFrmNew.update : Boolean;
begin
case progressvar
of
1 : lbl_oraconnect.Caption := '
Connected';
2 : lbl_orasleep.Caption := '
ausgeschlafen';
3 :
// im Moment nix;
end;
progressvar := 0;
// rücksetzen
Result := True;
end;
procedure TFrmNew.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
while orasessioninprogress
do begin
//
end;
qry_searchMA.Close;
OraSessCommon.Disconnect;
// MThread.Terminate;
// FreeAndNil(MThread);
FrmMain.killform(Self.
Name, Self.Tag);
end;
procedure TFrmNew.FormCreate(Sender: TObject);
begin
Self.Caption := Self.
Name;
end;
procedure TFrmNew.FormShow(Sender: TObject);
begin
lbl_FormName.Caption := self.
Name;
lbl_FormTag.Caption := inttostr(Self.Tag);
MThread := TMyThread.Create(True);
MThread.FormUsed := Self;
MThread.FreeOnTerminate := false;
MThread.Start;
end;
procedure TFrmNew.qry_searchMAAfterScroll(DataSet: TDataSet);
begin
mmo1.Text:=Self.qry_searchMAPER_STRORALOGIN.AsString;
end;
procedure TMyThread.Execute;
begin
orasessioninprogress := true;
FormUsed.OraSessCommon.Connect;
progressvar := 1;
MThread.Synchronize(doprogress);
// FormUsed.qry_searchMA.Open;
// FormUsed.fncsleep.ParamByName('i_seconds').AsInteger:=4;
// FormUsed.fncsleep.Execute;
orasessioninprogress := false;
progressvar := 3;
MThread.Synchronize(doprogress);
FormUsed.qry_searchMA.Open;
progressvar := 2;
MThread.Synchronize(doprogress);
end;
procedure TMyThread.doprogress;
begin
FormUsed.update;
end;
end.