Board index » delphi » Progress bar

Progress bar


2004-04-14 02:43:31 PM
delphi255
Hi
How can i remove borders of progress bar and chang the color of it.
Thank in advance
Mohammad-Reza Taikandi
 
 

Re:Progress bar

can anyone help me how to use the progress bar... I want to know how to associate the progress of the bar with an activity like saving a file and also is there a way to change the color of the progress bar and its outlook, I have been trying the code progressbar1.brush.color but the color still did not change to what i wanted
-crystal
 

Re:Progress bar

Please see the Help documentation on ProgressBar, and also the properties
accessible through the Object inspector:
ProgressBar.ForegroundColor / .BackgroundColor / .Color
Example on splashscreen, ProgressBy, TProgressBar
As for the "showing progress of saving" question:
I doubt this is possible for "automatic" saving like
TImage.Picture.SaveToFile,
but if you write your own saving procedure, something that goes like
AssignFile(TF,Filename)
Rewrite(TF)
I := Low(MyArray);
MyProgressBar.Min := 0;
MyProgressBar.Max := Length(MyArray);
While I < High(MyArray) do
begin
Writeln(TF,MyArray[I])
MyProgressBar.ProgressBy(1);
MyProgressBar.Refresh;
end;
CloseFile(TF);
... this should work. However, consider the performance impact of refreshing
the progressbar too often, so in the above example, I would suggest using
something like calculating 1% of the total saved volume, and only updating
the progress by after 5% or so.
"crystal" <XXXX@XXXXX.COM>píše v diskusním příspěvku
Quote

can anyone help me how to use the progress bar... I want to know how to
associate the progress of the bar with an activity like saving a file and
also is there a way to change the color of the progress bar and its outlook,
i've been trying the code progressbar1.brush.color but the color still did
not change to what i wanted
Quote

-crystal
 

Re:Progress bar

I'm looking for a method to show a progress bar in Delphi 6 while I execute
a store procedure,
so I can see the elapsed time and how much time I have left.
One of the problems is that I don't know the maximum limit for my progress
bar because my
store procedure could last between half or one hour.
I use MS SQL 7
Could anyone give me some suggestions?
Thanks
 

Re:Progress bar

Gonzalo Torres writes:
Quote
I'm looking for a method to show a progress bar in Delphi 6 while I execute
a store procedure,
so I can see the elapsed time and how much time I have left.
One of the problems is that I don't know the maximum limit for my progress
bar because my
store procedure could last between half or one hour.
I use MS SQL 7
Could anyone give me some suggestions?
Thanks


If you have no way of determining how long something will take, or how many
iterations it will need, then there's no way to set the progress bar. To
overcome this you may want to break up your stored procedure so that it only
does a fraction of the task on each call. This will certainly slow down the
overall time it takes to complete, but you can present some kind of progress --
again, only if you know how many iterations you will need.
On the other hand, if you just want to know if the process is still ticking
along, it then depends on the dataset component you're using and whether the
database drivers support asynchronous operation. In that situation you can
start a stored procedure and then update some visual widget until the call
completes, showing the user that it is working, if not how much of the work is
complete.
HTH
Todd Grigsby
TGE Software
 

Re:Progress bar

Could someone provide me with the correct syntax to set the color of the
Progress Bar please.
 

Re:Progress bar

"Lerner" <XXXX@XXXXX.COM>writes:
Quote

Could someone provide me with the correct syntax to set the
color of the Progress Bar please.
I don't recall how but this question has been asked many times
before. Please search the archives:
www.tamaracka.com/search.htm
~ JD
 

Re:Progress bar

"Lerner" <XXXX@XXXXX.COM>writes
Quote
Could someone provide me with the correct syntax to set
the color of the Progress Bar please.
TProgressBar does not natively support user-defined colors. You have to
issue the PBM_SETBKCOLOR and PBM_SETBARCOLOR messages directly to the
Progress Bar's window manually.
SendMessage(ProgressBar1->Handle, PBM_SETBARCOLOR, 0,
reinterpret_cast<LPARAM>(ColorToRGB(clRed)));
SendMessage(ProgressBar1->Handle, PBM_SETBKCOLOR, 0,
reinterpret_cast<LPARAM>(ColorToRGB(clBlack)));
Or:
ProgressBar1->Perform(PBM_SETBARCOLOR, 0, ColorToRGB(clRed));
ProgressBar1->Perform(PBM_SETBKCOLOR, 0, ColorToRGB(clBlack));
Gambit
 

Re:Progress bar

"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>writes
Quote

"Lerner" <XXXX@XXXXX.COM>writes
news:441c2a32$XXXX@XXXXX.COM...

>Could someone provide me with the correct syntax to set
>the color of the Progress Bar please.
Thanks - you saved me a lot of frustration!

 

Re:Progress bar

The following line seeme much simpler than Remy's.
PBar->Brush->Color = clLime;
George
"Remy Lebeau \(TeamB\)" <XXXX@XXXXX.COM>writes:
You have to
Quote
issue the PBM_SETBKCOLOR and PBM_SETBARCOLOR messages directly to the
Progress Bar's window manually.
..................................>
 

Re:Progress bar

Thanks George but the compiler did not recognise PBar
This was one of the problems I had originally - knowing how to address the
progress bar as I
couldn't find a reference for it in the help file.
"george" <XXXX@XXXXX.COM>writes
Quote

The following line seeme much simpler than Remy's.

PBar->Brush->Color = clLime;

George

"Remy Lebeau \(TeamB\)" <XXXX@XXXXX.COM>writes:

You have to
>issue the PBM_SETBKCOLOR and PBM_SETBARCOLOR messages directly to the
>Progress Bar's window manually.
..................................>
 

Re:Progress bar

"Lerner" <XXXX@XXXXX.COM>writes
Quote
Thanks George but the compiler did not recognise PBar

This was one of the problems I had originally - knowing
how to address the progress bar as I couldn't find a reference
for it in the help file.
You reference it using the Name that you have assigned to it in the Object
Inspector (assuming that you are working with a TProgressBar that you
dropped on the form at design-time).
Gambit
 

Re:Progress bar

Yes of course. that is right, PBar is my name for my progress bar. I am sorry I just cut and pasted a line from my working code. The help text (for TProgressBar) says Brush is a read only property, but I seem to have successfully ignored that.
George
"Remy Lebeau \(TeamB\)" <XXXX@XXXXX.COM>writes:
Quote

"Lerner" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>Thanks George but the compiler did not recognise PBar
>
>This was one of the problems I had originally - knowing
>how to address the progress bar as I couldn't find a reference
>for it in the help file.

You reference it using the Name that you have assigned to it in the Object
Inspector (assuming that you are working with a TProgressBar that you
dropped on the form at design-time).


Gambit


 

Re:Progress bar

"George" <XXXX@XXXXX.COM>writes
Quote
The help text (for TProgressBar) says Brush is a read only property,
but I seem to have successfully ignored that.
The Brush property itself is read-only, so you cannot assign an external
TBrush object to the property directly. But the TBrush sub-properties are
not read-only.
Gambit
 

Re:Progress bar

Hello,
I have loop in which I do some lengthy operations. I want to
bring up a dialog box havaing a progress bar and show the
amount of work being done. Also I want to place a cancel button
on dialog box and let the user cancel the operation. I can
modify the progress bar showing the progress of the operation,
but while doing so in the loop, the cancel button does not work.
How can I fix the problem.
Thanks
Mohsen