ibrobar
asked on
Delphi4 - progress bar usage
Hi
I am using a progressbar while loading treeview from paradox table.
but my problem is that the progress of the bar is not moving with the load operation.meaning that it finishes loading the bar and then loading the tree.
My code is :
try
with progressbar1 do begin
stepit;
BuildTree; // i am callling procedure to load the tree from the table
finally
free
end
so how can i make it move together so when the progress of the bar finishes i will load the tree immidealty not wait for more time and the bar is at the max position
thanks a lot
I am using a progressbar while loading treeview from paradox table.
but my problem is that the progress of the bar is not moving with the load operation.meaning that it finishes loading the bar and then loading the tree.
My code is :
try
with progressbar1 do begin
stepit;
BuildTree; // i am callling procedure to load the tree from the table
finally
free
end
so how can i make it move together so when the progress of the bar finishes i will load the tree immidealty not wait for more time and the bar is at the max position
thanks a lot
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i almost forgot ... insert an Application.ProcessMessage s; in your loop to allow your form to respond to paint message.
var
i, loopVal: integer;
begin
try
// open the query
ADOQuery1.Open;
// turn off treeview update
TreeView1.Items.BeginUpdat e;
try
// get max loop value and max progress bar position
loopVal := ADOQuery1.RecordCount;
// set the max of the progress bar
ProgressBar1.Max := loopVal;
for i := 1 to loopVal do
begin
// add treenode
// update progress bar
ProgressBar1.Position := i;
// let the system catch up
Application.ProcessMessage s;
end;
finally
// turn on treeview
TreeView1.Items.EndUpdate;
end;
except
// handle exception
end;
end;
i, loopVal: integer;
begin
try
// open the query
ADOQuery1.Open;
// turn off treeview update
TreeView1.Items.BeginUpdat
try
// get max loop value and max progress bar position
loopVal := ADOQuery1.RecordCount;
// set the max of the progress bar
ProgressBar1.Max := loopVal;
for i := 1 to loopVal do
begin
// add treenode
// update progress bar
ProgressBar1.Position := i;
// let the system catch up
Application.ProcessMessage
end;
finally
// turn on treeview
TreeView1.Items.EndUpdate;
end;
except
// handle exception
end;
end;
ASKER
Hi All
Sorry for the delay , I will get back to you in couple of days
regards
Sorry for the delay , I will get back to you in couple of days
regards