danil082697
asked on
Wait for a some process
I am making a database access, and i want a massage box
("Please Wait")to be displayed all the time while the query is running. And it wouldn't close until the query is running.
("Please Wait")to be displayed all the time while the query is running. And it wouldn't close until the query is running.
Hi,
I would prefer to use ShowModal, because danil doesn't wants that the user can do anything else if the query is still running. Also hide all bordericons (no cancel button available etc). set biSystemMenu to false, etc.
Although this is great, if the time is long for quering, the user can become impatient. Therefor I would suggest to place a gauge (or something like that) to indicate the progress of the query.
The beauty is that the free RXLib has such a component which can be attached to a query and can give status of the progress to a gauge or progress bar. http://rx.demo.ru.
So this we don't have to program ourselfs :-))
Regards, Zif.
I would prefer to use ShowModal, because danil doesn't wants that the user can do anything else if the query is still running. Also hide all bordericons (no cancel button available etc). set biSystemMenu to false, etc.
Although this is great, if the time is long for quering, the user can become impatient. Therefor I would suggest to place a gauge (or something like that) to indicate the progress of the query.
The beauty is that the free RXLib has such a component which can be attached to a query and can give status of the progress to a gauge or progress bar. http://rx.demo.ru.
So this we don't have to program ourselfs :-))
Regards, Zif.
forgot to mention : the component of RxLib call DBProgress (how convienient!)
Hi Zif,
I don't know this DBProgress (since I don't use Databases at all). If it works: Fine. Then please forget the rest of this comment... :-)
Your ShowModal suggestion wouldn't work, because ShowModal returns only if the form (that is shown with ShowModal) is closed.
So something like
Waitform.showModal;
query1.open;
Waitform.close;
won't work. "Waitfrom.showModal" will return in that moment, where Waitform is closed.
Regards, Madshi.
I don't know this DBProgress (since I don't use Databases at all). If it works: Fine. Then please forget the rest of this comment... :-)
Your ShowModal suggestion wouldn't work, because ShowModal returns only if the form (that is shown with ShowModal) is closed.
So something like
Waitform.showModal;
query1.open;
Waitform.close;
won't work. "Waitfrom.showModal" will return in that moment, where Waitform is closed.
Regards, Madshi.
Hi Madshi,
:-) Your correct, I was forgetting some things... ShowModal can't work the way I proposed.... But if we can cach the progress, we can catch the end and we can fire the on close event that way... wow, what a mistake.. .thanks for pointing me out.
so new proposal :
In form1
Form2.ShowModal;
with in form2.activate (or another event): doQuery
with in Query-end (DBProgress?) event : close (to close form2);
Regards, Zif/
:-) Your correct, I was forgetting some things... ShowModal can't work the way I proposed.... But if we can cach the progress, we can catch the end and we can fire the on close event that way... wow, what a mistake.. .thanks for pointing me out.
so new proposal :
In form1
Form2.ShowModal;
with in form2.activate (or another event): doQuery
with in Query-end (DBProgress?) event : close (to close form2);
Regards, Zif/
That should work... :-)
wouldn't something like
if "Query is Busy" then Action := caNone;
in the FormClose event handler be easy here ?
if "Query is Busy" then Action := caNone;
in the FormClose event handler be easy here ?
yes ahalya, but how to know when a 'query is busy'? --> DBProgress code, my guess.
Hi,All
I think you can try multithread if you like.
For example:
.....in form1
var
aThread: TThreadQuery;
bThread: TThreadForm;
procedure TForm1.Button1Click(Sender : TObject);
begin
aThread:= TThreadQuery.Create(False) ;
bThread:= TThreadShowForm.Create(Fal se);
......
end;
....in unit2
procedure TThreadQuery.Execute;
begin
{ Place thread code here }
.....
form1.bThread.Terminate;
form1.bThread.Suspend;
form1.bThread.Free;
end;
.....in unit3
procedure TThreadShowForm.Execute;
begin
{ Place thread code here }
Form2:= TForm2.Create(self);
Form2.ShowModal;
.....
end;
procedure TThreadShowForm.Terminate;
begin
{ Place thread code here }
TForm2.Close;
TForm2.Free;
.....
end;
But it looks too trouble!!!
HaHa!
Regards,
Shock
I think you can try multithread if you like.
For example:
.....in form1
var
aThread: TThreadQuery;
bThread: TThreadForm;
procedure TForm1.Button1Click(Sender
begin
aThread:= TThreadQuery.Create(False)
bThread:= TThreadShowForm.Create(Fal
......
end;
....in unit2
procedure TThreadQuery.Execute;
begin
{ Place thread code here }
.....
form1.bThread.Terminate;
form1.bThread.Suspend;
form1.bThread.Free;
end;
.....in unit3
procedure TThreadShowForm.Execute;
begin
{ Place thread code here }
Form2:= TForm2.Create(self);
Form2.ShowModal;
.....
end;
procedure TThreadShowForm.Terminate;
begin
{ Place thread code here }
TForm2.Close;
TForm2.Free;
.....
end;
But it looks too trouble!!!
HaHa!
Regards,
Shock
It should be:
procedure TThreadShowForm.Terminate;
begin
{ Place thread code here }
Form2.Close;
Form2.Free;
.....
end;
procedure TThreadShowForm.Terminate;
begin
{ Place thread code here }
Form2.Close;
Form2.Free;
.....
end;
form2 and unit2 are different units
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi friends,
simple questions become complex answers.
a other idea
while not play animation while waiting
something like
createprocess(someparamete rs); {i.e start mediaplayer and show a movie}
query1.open;
terminateprocess(someparam eters);
meikl
simple questions become complex answers.
a other idea
while not play animation while waiting
something like
createprocess(someparamete
query1.open;
terminateprocess(someparam
meikl
ASKER
thanks guys
make a form name it i.e. Waitform
and use this code
Waitform.show;
query1.open;
Waitform.close;
meikl