Discussion:
Placing a TProgressBar into a TStatusBar
Andrea Mauri
2009-03-10 16:01:27 UTC
Permalink
Dear all,
anyone can suggest me a way in order to place a TProgressBar into a
TStatusBar?
I found some tutorials but they are just for Delphi and Win.
Thanks,
Andrea
matt shaffer
2009-03-10 19:47:42 UTC
Permalink
I'm going to give you a possibility but it will probably not be the best
way. I have laz 9.26.3; and the status bar has a z order. This means, you
can set the progress bar's z order to top and it should be able to be moved
on top of the status bar. Is this considered a bug? I don't know. Doing it
this way may also require you to do a bit more work, but it's the only way I
can think of.
Post by Andrea Mauri
Dear all,
anyone can suggest me a way in order to place a TProgressBar into a
TStatusBar?
I found some tutorials but they are just for Delphi and Win.
Thanks,
Andrea
_______________________________________________
Lazarus mailing list
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Reenen Laurie
2009-03-10 20:40:55 UTC
Permalink
Anchoring it "on" the statusbar might work?
Post by matt shaffer
I'm going to give you a possibility but it will probably not be the best
way. I have laz 9.26.3; and the status bar has a z order. This means, you
can set the progress bar's z order to top and it should be able to be moved
on top of the status bar. Is this considered a bug? I don't know. Doing it
this way may also require you to do a bit more work, but it's the only way I
can think of.
Post by Andrea Mauri
Dear all,
anyone can suggest me a way in order to place a TProgressBar into a
TStatusBar?
I found some tutorials but they are just for Delphi and Win.
Thanks,
Andrea
_______________________________________________
Lazarus mailing list
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
_______________________________________________
Lazarus mailing list
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
--
o__
,_.>/ _
(_)_\(_)_______
...speed is good
_______________
I believe five out of four people have a problem with fractions.
Reenen Laurie
2009-03-10 20:42:02 UTC
Permalink
Also... What I've done before...

Just add the text...
0%
5%
15%
95%
100%

Not so "nice" but effective.
Post by Reenen Laurie
Anchoring it "on" the statusbar might work?
I'm going to give you a possibility but it will probably not be the best
Post by matt shaffer
way. I have laz 9.26.3; and the status bar has a z order. This means, you
can set the progress bar's z order to top and it should be able to be moved
on top of the status bar. Is this considered a bug? I don't know. Doing it
this way may also require you to do a bit more work, but it's the only way I
can think of.
Post by Andrea Mauri
Dear all,
anyone can suggest me a way in order to place a TProgressBar into a
TStatusBar?
I found some tutorials but they are just for Delphi and Win.
Thanks,
Andrea
_______________________________________________
Lazarus mailing list
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
_______________________________________________
Lazarus mailing list
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
--
o__
,_.>/ _
(_)_\(_)_______
...speed is good
_______________
I believe five out of four people have a problem with fractions.
--
o__
,_.>/ _
(_)_\(_)_______
...speed is good
_______________
I believe five out of four people have a problem with fractions.
c***@mail.ru
2009-03-13 19:44:00 UTC
Permalink
Здравствуйте, Andrea.

Try this:

procedure TForm1.FormCreate(Sender: TObject);
var
ProgressBar1: TProgressBar;
begin
ProgressBar1:= TProgressBar.Create(StatusBar1);
with ProgressBar1 do
begin
Parent := StatusBar1;
Left := 50;
Visible:= true;
Height:=15;
Width:=50;
Max:=100;
Position:=20;
end;
end;
Post by Andrea Mauri
Dear all,
anyone can suggest me a way in order to place a TProgressBar into a
TStatusBar?
I found some tutorials but they are just for Delphi and Win.
Thanks,
Andrea
--
С уважением,
Cobalt747 mailto:***@mail.ru
Andrea Mauri
2009-03-13 21:02:36 UTC
Permalink
Thanks, it works.
Just the Left property seems to have no effect, the ProgressBar is
placed on the left corner ot the StatusBar1, like having Left:= 0.

There's a way to associate a ProgressBar with a TStatusPanel?
I tried using this code, but nothing happens:

procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
begin
if Panel = StatusBar.Panels[1] then
with ProgressBar1 do
begin
Top := Rect.Top;
Left := Rect.Left;
Width := Rect.Right - Rect.Left - 5;
Height := Rect.Bottom - Rect.Top;
end;
end;

Regards,
Andrea
Post by c***@mail.ru
Здравствуйте, Andrea.
procedure TForm1.FormCreate(Sender: TObject);
var
ProgressBar1: TProgressBar;
begin
ProgressBar1:= TProgressBar.Create(StatusBar1);
with ProgressBar1 do
begin
Parent := StatusBar1;
Left := 50;
Visible:= true;
Height:=15;
Width:=50;
Max:=100;
Position:=20;
end;
end;
Post by Andrea Mauri
Dear all,
anyone can suggest me a way in order to place a TProgressBar into a
TStatusBar?
I found some tutorials but they are just for Delphi and Win.
Thanks,
Andrea
--
Dr. Andrea Mauri, PhD
Milano Chemometrics and QSAR Research Group
Department of Environmental Sciences
University of Milano-Bicocca
P.zza della Scienza, 1
20126 Milano - Italy

Tel: ++39 02 64482801
mailto:***@gmail.com
http://michem.disat.unimib.it/chm/
c***@mail.ru
2009-03-13 22:51:40 UTC
Permalink
Здравствуйте, Andrea.

I think, now it is no way to associate some control with
TCollectionItem-descendant like TStatusPanel

I make it with OnResize event by updating it's coordinates.
Post by Andrea Mauri
Thanks, it works.
Just the Left property seems to have no effect, the ProgressBar is
placed on the left corner ot the StatusBar1, like having Left:= 0.
There's a way to associate a ProgressBar with a TStatusPanel?
procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
begin
if Panel = StatusBar.Panels[1] then
with ProgressBar1 do
begin
Top := Rect.Top;
Left := Rect.Left;
Width := Rect.Right - Rect.Left - 5;
Height := Rect.Bottom - Rect.Top;
end;
end;
--
С уважением,
Cobalt747 mailto:***@mail.ru
Loading...