Autor |
Beitrag |
Michael POHL
      
Beiträge: 51
Win 7 pro / 10/64 pro
D2010 Pro LMD 10 / D5 pro LMD 5
|
Verfasst: 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. 
_________________ 100 Jahre leben heisst 100 Jahre lernen.
|
|
ZeitGeist87
      
Beiträge: 1593
Erhaltene Danke: 20
Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
|
Verfasst: 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
      
Beiträge: 591
Erhaltene Danke: 14
|
Verfasst: Do 26.07.07 15:08
ZeitGeist87 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:
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;
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; 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; end; |
Gruss Reinhard
|
|
ZeitGeist87
      
Beiträge: 1593
Erhaltene Danke: 20
Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
|
Verfasst: Do 26.07.07 15:13
Reinhard Kern hat folgendes geschrieben: | ZeitGeist87 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:
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;
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; 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; 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 
      
Beiträge: 51
Win 7 pro / 10/64 pro
D2010 Pro LMD 10 / D5 pro LMD 5
|
Verfasst: 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
      
Beiträge: 8721
Erhaltene Danke: 191
Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
|
Verfasst: 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
      
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: Do 26.07.07 17:39
und wie soll man die dann da unten in der Statusleiste anzeigen lassen?
|
|
ZeitGeist87
      
Beiträge: 1593
Erhaltene Danke: 20
Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
|
Verfasst: 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
      
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: Do 26.07.07 17:56
die ProgrssBar... wenn ich das als Unterobjekt mache, dann wird es gar nicht angezeigt
|
|
ZeitGeist87
      
Beiträge: 1593
Erhaltene Danke: 20
Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
|
Verfasst: Do 26.07.07 18:08
oder so
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 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
      
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: Do 26.07.07 20:02
|
|
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1
|
Verfasst: Do 26.07.07 20:22
Wolle92 hat folgendes geschrieben: | SB_GETRECT ist unbekannt |
Auch der Forensuche?
|
|
BenBE
      
Beiträge: 8721
Erhaltene Danke: 191
Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
|
Verfasst: 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
      
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: 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
|
|
|