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)
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:
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
Tino: Code- durch Delphi-Tags ersetzt.