Autor |
Beitrag |
Chris1308
Beiträge: 220
Win XP Prof.
D2005 Prof, D7 Prof, D7 Pers
|
Verfasst: So 23.06.02 19:16
Hi @all!
Wie kann ich eine Progressbar in ein Panel (z.B. in Panels[1]) einer Statusbar einbinden? Ich weiß, dass das geht, aber wie?
Ich hab' das irgendwo schonmal gelesen.
Chris1308
|
|
Klabautermann
Beiträge: 6366
Erhaltene Danke: 60
Windows 7, Ubuntu
Delphi 7 Prof.
|
Verfasst: So 23.06.02 22:12
Hallo,
wenn du es zur Designzeit mit der Maus können willst, dann leite dir eine Komponente von tStatusbar ab und überschreibe den Constructor folgendermaßen:
Quelltext 1: 2: 3: 4: 5:
| constructor tObjectStatusBar.Create(AOwner: tComponent); begin inherited; ControlStyle := ControlStyle + [csAcceptsControls]; end; // Construktor |
Auf deinem neu geschafenen Statusbar kannst du nun jede Komponente ablegen und frei positionieren.
Bei der Alternative muss ich mutmaßen. Ich Tippe aber drauf das es möglich ist die Parent Eigenschaft des Prograsbar auf das Panel zu setzen.
Gruß
Klabautermann
|
|
mathias
Beiträge: 58
Erhaltene Danke: 3
|
Verfasst: So 23.06.02 22:37
|
|
Klabautermann
Beiträge: 6366
Erhaltene Danke: 60
Windows 7, Ubuntu
Delphi 7 Prof.
|
Verfasst: So 23.06.02 23:03
Dann hatte ich ja recht mit meiner Mutmaßung .
Naja, das mit der Komponente habe ich halt im einsatz.
|
|
Chris1308
Beiträge: 220
Win XP Prof.
D2005 Prof, D7 Prof, D7 Pers
|
Verfasst: Mo 24.06.02 14:59
Thx!
Ich versuche das heute mal so:
Quelltext 1: 2: 3: 4:
| procedure TForm1.Create (Seder: TObject); begin ProgressBar1.Parent := StatusBar1.Panels[1]; end; |
Weiß aber noch nicht ob das funzt...
Chris1308
|
|
Torsten
Beiträge: 160
|
Verfasst: Mo 24.06.02 15:43
Wird es nicht.
|
|
Chris1308
Beiträge: 220
Win XP Prof.
D2005 Prof, D7 Prof, D7 Pers
|
Verfasst: Mo 24.06.02 17:04
@ Klabautermann:
Kann ich dann bei der Kompo es so machen, dass die ProgressBar in einem Panel erscheint?
Chris1308
|
|
Chris1308
Beiträge: 220
Win XP Prof.
D2005 Prof, D7 Prof, D7 Pers
|
Verfasst: Mo 24.06.02 17:11
Das mit der Kompo funzt irgendwie nicht. Habe das geschrieben, wie du gesagt hast, aber das funktioniert trotzdem nicht...
Chris1308
|
|
Klabautermann
Beiträge: 6366
Erhaltene Danke: 60
Windows 7, Ubuntu
Delphi 7 Prof.
|
Verfasst: Mo 24.06.02 17:18
Hallo,
hier einmal der komplette (wahnsinig aufwendige ) Source der Komponente die ich einsetze:
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:
| unit oObjectStatusBar;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls;
type toObjectStatusBar = class(TStatusBar) private { Private-Deklarationen } protected { Protected-Deklarationen } public constructor Create(AOwner : tComponent); override; published { Published-Deklarationen } end;
implementation
{ toObjectStatusBar }
constructor toObjectStatusBar.Create(AOwner: tComponent); begin inherited; ControlStyle := ControlStyle + [csAcceptsControls]; end; // Construktor
end. |
Mit dieser Variante erscheinen die Komponenten tatsächlich nicht auf den Pannels sondern völlig frei plazierbar. Wenn du eine mischung aus meiner und mathias lösung haben willst wird das ganze glaube ich ziemlich aufwendig.
Gruß
Klabautermann
|
|
Chris1308
Beiträge: 220
Win XP Prof.
D2005 Prof, D7 Prof, D7 Pers
|
Verfasst: Mo 24.06.02 17:29
Und wie kann ich die jetzt nutzen? Du hast nämlich irgendwie keine RegisterComponent drin...
Chris1308
|
|
Klabautermann
Beiträge: 6366
Erhaltene Danke: 60
Windows 7, Ubuntu
Delphi 7 Prof.
|
Verfasst: Mo 24.06.02 17:31
Stimmt, das musst du noch einfügen. Ich mache das an einer zentralen Stelle in dem Package.
Aber da du bemerkt hast das es fehlt wirst du es sicher hinkriegen .
Gruß
Klabautermann
|
|
Chris1308
Beiträge: 220
Win XP Prof.
D2005 Prof, D7 Prof, D7 Pers
|
Verfasst: Mo 24.06.02 17:42
|
|