Autor Beitrag
Michael POHL
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51

Win 7 pro / 10/64 pro
D2010 Pro LMD 10 / D5 pro LMD 5
BeitragVerfasst: Do 26.07.07 11:49 
:?: Hallo Kollegen!
Kann mir jemand verraten wie man eine Progressbar in der Statuszeile integriert.
So wie beim Internet Explorer. :roll:

_________________
100 Jahre leben heisst 100 Jahre lernen.
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 26.07.07 11:53 
Hallo!

Nimm die Progressbar (Register Win32) und drop sie auf der Statusbar.

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Reinhard Kern
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 591
Erhaltene Danke: 14



BeitragVerfasst: Do 26.07.07 15:08 
user profile iconZeitGeist87 hat folgendes geschrieben:
Hallo!

Nimm die Progressbar (Register Win32) und drop sie auf der Statusbar.

LG
Stefan


Hallo,

das geht bei älteren (Windows?Delphi?) Versionen nicht - was aber immer geht, ist eine Progressbar irgendwo unterzubringen und zur Laufzeit Position und Grösse auf die Werte des Abschnitts der Statusbar zu ändern:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
  TProcessGauge = class
    PG : TProgressBar;
    PGL : TLabel;
    SB : TStatusBar;
    SBPanel : integer;
    SBText : integer;
    FullScale : longint;
    procedure connect (B : TProgressBar; L : TLabel);
    procedure prepare (fs : longint; lt : ShortString);
    procedure update (cv : longint);
    procedure add (cv : longint);
    procedure finish;
    procedure clear;
    procedure IntoStatusBar (ParentSB : TStatusBar; PBPanel,LPanel : integer);
    end;

  { call this from FormShow after create and connect }
procedure TProcessGauge.IntoStatusBar (ParentSB : TStatusBar; PBPanel,LPanel : integer);
var xe,ye : integer;
    PBRect : TRect;
    PBStyle : integer;
begin
if not Assigned (PG) then exit;
if not Assigned (ParentSB) then exit;
SB := ParentSB;
SBPanel := PBPanel;
SBText := LPanel;
SB.Perform (SB_GETRECT,SBPanel,integer (@PBRect));
PG.Parent := SB;     { Progressbar in Statusbar }
PBStyle := GetWindowLong (PG.Handle,GWL_EXSTYLE);
PBStyle := PBStyle and not WS_EX_STATICEDGE;
SetWindowLong(PG.Handle,GWL_EXSTYLE,PBStyle);
with PBRect do
  begin
  xe := GetSystemMetrics (SM_CXEDGE);
  ye := GetSystemMetrics (SM_CYEDGE);
  Left := Left + xe + 1;
  Top := Top + ye + 1;
  Right := Right - xe - 1;
  Bottom := Bottom - ye - 1;
  end;
PG.BoundsRect := PBRect;
PG.Visible := false;
Application.ProcessMessages; { redraw  statusbar }
end;


Gruss Reinhard
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 26.07.07 15:13 
user profile iconReinhard Kern hat folgendes geschrieben:
user profile iconZeitGeist87 hat folgendes geschrieben:
Hallo!

Nimm die Progressbar (Register Win32) und drop sie auf der Statusbar.

LG
Stefan


Hallo,

das geht bei älteren (Windows?Delphi?) Versionen nicht - was aber immer geht, ist eine Progressbar irgendwo unterzubringen und zur Laufzeit Position und Grösse auf die Werte des Abschnitts der Statusbar zu ändern:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
  TProcessGauge = class
    PG : TProgressBar;
    PGL : TLabel;
    SB : TStatusBar;
    SBPanel : integer;
    SBText : integer;
    FullScale : longint;
    procedure connect (B : TProgressBar; L : TLabel);
    procedure prepare (fs : longint; lt : ShortString);
    procedure update (cv : longint);
    procedure add (cv : longint);
    procedure finish;
    procedure clear;
    procedure IntoStatusBar (ParentSB : TStatusBar; PBPanel,LPanel : integer);
    end;

  { call this from FormShow after create and connect }
procedure TProcessGauge.IntoStatusBar (ParentSB : TStatusBar; PBPanel,LPanel : integer);
var xe,ye : integer;
    PBRect : TRect;
    PBStyle : integer;
begin
if not Assigned (PG) then exit;
if not Assigned (ParentSB) then exit;
SB := ParentSB;
SBPanel := PBPanel;
SBText := LPanel;
SB.Perform (SB_GETRECT,SBPanel,integer (@PBRect));
PG.Parent := SB;     { Progressbar in Statusbar }
PBStyle := GetWindowLong (PG.Handle,GWL_EXSTYLE);
PBStyle := PBStyle and not WS_EX_STATICEDGE;
SetWindowLong(PG.Handle,GWL_EXSTYLE,PBStyle);
with PBRect do
  begin
  xe := GetSystemMetrics (SM_CXEDGE);
  ye := GetSystemMetrics (SM_CYEDGE);
  Left := Left + xe + 1;
  Top := Top + ye + 1;
  Right := Right - xe - 1;
  Bottom := Bottom - ye - 1;
  end;
PG.BoundsRect := PBRect;
PG.Visible := false;
Application.ProcessMessages; { redraw  statusbar }
end;


Gruss Reinhard


unter win98 mit delphi7pro geht es

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Michael POHL Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51

Win 7 pro / 10/64 pro
D2010 Pro LMD 10 / D5 pro LMD 5
BeitragVerfasst: Do 26.07.07 15:38 
Werde zuhause mal testen ob meine Konfiguration (XP D5 Pro) geht oder nicht.

_________________
100 Jahre leben heisst 100 Jahre lernen.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Do 26.07.07 15:40 
Es gibt auch eine andere Möglichkeit (die aber etwas Vorsicht bei der Umsetzung benötigt:

Einfach Progress-BAr auf's Form ziehen und dann in die DFM-Ansicht wechseln und sie dort als Unterobjekt der Statuszeile einfügen.

Wie gesagt: Etwas Vorsicht dabei und ggf. vorher von der DFM n Backup machen ;-)

Ansonsten wie vorgeschlagen die Laufzeit-Lösung ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Wolle92
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Do 26.07.07 17:39 
und wie soll man die dann da unten in der Statusleiste anzeigen lassen?
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 26.07.07 17:48 
was?

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Wolle92
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Do 26.07.07 17:56 
die ProgrssBar... wenn ich das als Unterobjekt mache, dann wird es gar nicht angezeigt
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 26.07.07 18:08 
oder so

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
type
  TMyControl = class(TControl);

procedure TMyForm.FormCreate(Sender: TObject);
var PanelRect: TRect;
begin
 //Progressbar auf die Statusbar
 TMyControl(ProgressBar1).SetParent(StatusBar1);
 SendMessage(StatusBar1.Handle, SB_GETRECT, 1, Integer(@PanelRect));
 with PanelRect do
  ProgressBar1.SetBounds(Left, Top, Right - Left, Bottom - Top);
end;


LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Wolle92
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Do 26.07.07 20:02 
SB_GETRECT ist unbekannt
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 26.07.07 20:22 
user profile iconWolle92 hat folgendes geschrieben:
SB_GETRECT ist unbekannt

Auch der Forensuche?
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Do 26.07.07 22:34 
@Unterobjekt: Bitte Upgrade auf Brain 1.0, die hätte Dir vorgeschlagen mitzudenken, dass man bei dem Unter-Objekt die Koordinaten mal hätte anpassen müssen ;-)

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Wolle92
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Fr 27.07.07 08:41 
SB_GETRECT ist in CommCtrls, habs gefunden...
Dachte erst, das ist nen Tippfehler, als ich bei Google suchte und wunderte mich, aber als ich es das 5 Mal sah und es auch in der Delphi-Source liegt, dachte ich "Hmm... Mal ausprobieren"

@Luckie: Ja, wenn ich es in die Forensuche eingebe, kommt nur dieses Thema hier als Ergebnis