Autor Beitrag
Luzzifus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 200

Win2K
D6 Prof
BeitragVerfasst: Sa 16.10.04 10:27 
Mein Programm muss beim Starten Daten aus einer Text-Datenbank lesen. Da das bei etwas größerer Datenbank auch ein wenig länger dauert, bin ich nun gerade dabei, per ProgressBar eine Lade-Fortschritts-Anzeige einzubauen.

Und zwar hab ich eine zusätzliche Form erstellt, auf der ich die ProgressBar platziert habe. Danach hab ich mir die .dpr Datei hergenommen und wie folgend verändert:

(Form1 = MainForm, Form5 = Form mit der ProgressBar)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
begin
  Application.Initialize;
  Application.Title := '...';

  Application.CreateForm(TForm5, Form5);
  Form5.Show;

  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm3, Form3);
  Application.CreateForm(TForm4, Form4);
  
  Form5.Close;
  Form1.Show;

  if mode2av and showStartDlg then Form3.ShowModal;
  Application.Run;
end.


Nun hab ich aber das Problem, dass sobald ich die Form5 schließe, das gesamte Programm geschlossen wird. Jetzt hab ich einfach bisserl rumprobiert und ne ziemlich komische Lösung gefunden:

ausblenden 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:
begin
  Application.Initialize;
  Application.Title := '...';

  Application.CreateForm(TForm5, Form5);
  Form5.Show;

  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm3, Form3);
  Application.CreateForm(TForm4, Form4);
  
  Form5.Parent := Form1;
  Form1.Show;

  if mode2av and showStartDlg then Form3.ShowModal;
  Application.Run;
end.

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Form5.Close;
end;

Das erkenne aber sogar ich dass das ned besonders elegant ist.

Also: Wie kann ich gleich nach dem Ladevorgang die Form5 beenden, ohne dass das ganze Programm beendet wird? Achja, ich arbeite mit Delphi6.

Vielen Dank für jegliche Hilfe. ;)

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
Luzzifus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 200

Win2K
D6 Prof
BeitragVerfasst: Sa 16.10.04 11:24 
Naja ok hab's selbst gelöst.

Ich habe nun alles was lange dauert aus den OnCreate-Prozeduren rausgenommen und in eigene Prozeduren geschrieben. Dann hab ich Folgendes gemacht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.FormShow(Sender: TObject);
begin
  StartupWifProgress;
end;

procedure TForm1.StartupWifProgress;
begin
  Form5.Show;
  
  // zeugs laden und sowas..

  Form5.Close;
end;


Die ganzen Modifikation in der .dpr Datei hab ich wieder rausgenommen.

Keine Ahnung, warum ich da ned eher drauf gekommen bin.. *gg

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.