Autor Beitrag
giantdwarf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Delphi 5, Delphi 2006 Prof, Delphi 2009
BeitragVerfasst: Fr 10.02.06 16:01 
Hallo zusammen!

Ich habe eine Progressbar auf einem Splashscreen plaziert. Sie soll über einen Timer aktualisiert werden, bis das Splashscreen sich wieder schließt. Aber da bewegt sich überhaupt nichts. Application.ProcessMessage habe ich schon versucht. Funktioniert aber vermutlich zu dem Zeitpunkt noch nicht.

Hier der Soucecode aus dem Timer:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TSplashScreenfrm.timSplashCloseTimer( Sender: TObject)
begin
   prgbSplashScreen.StepIt;
   prgbSplashScreen.Refresh;
   FTimeCount := FTimeCount + 1;
   if ( FTimeCount mod 150 = 0 ) then
   begin
      timSplashClose.Enabled := False;
      Close;
   end;
end;



Mfg

GiantDwarf

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
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: Fr 10.02.06 16:07 
Mit nem Timer wirst Du bei SplashScreens immer Probleme bekommen. Die werden zwar (rein theoretisch) verarbeitet, aber funktionieren tuts nur sporadisch.

Zu deinem Source:
1. Bitte nutze Delphi-Tags. Liest sich besser.

2. Update mal nicht die Progressbar, sondern den SplashScreen. Ein Update sollte reichen. Repaint hat genug Nebeneffekte um es nicht zu nutzen ...

_________________
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.
giantdwarf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Delphi 5, Delphi 2006 Prof, Delphi 2009
BeitragVerfasst: Mo 13.02.06 20:49 
Vielen Dank für Deine Hilfe. Aber das habe ich auch schon vergeblich versucht. Den Timer nutze ich in erster Linie um den Splash zu schließen und dachte, dann kann ich gleich auch die Progressbar aktualisieren.
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Mo 13.02.06 21:40 
Normalerweise wird eine ProgressBar durch eine Schleife erhöht, in welcher langwierige Dinge verarbeitet werden.
Oder soll das nur Show sein? :D

Das ins FormActivate und bei mir funktionierts.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.FormActivate(Sender: TObject);
var
  i: Integer;
begin
  for i := 0 to 100 do begin
    ProgressBar1.Position := i;
    Form1.Refresh;
    Sleep(100);
  end;
  Close;
end;

Die Sanduhr bekommst du weg wenn du Application.ProcessMessages; noch mit reintust.
giantdwarf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35


Delphi 5, Delphi 2006 Prof, Delphi 2009
BeitragVerfasst: Di 14.02.06 09:19 
Danke, das war ein guter Tipp. Ich hatte es zwar auch schon mit einer Schleife probiert. Aber nicht im FormActivate. Ich kann zwar nicht Form1.Update benutzen, da bekomme ich eine AccessViolation. Wahrscheinlich, weil die Hauptform ja noch nicht da ist. Aber Prgbar.Update funktioniert. Und ja, im Moment ist das ganze noch Show. Aber das wird nicht so bleiben.