Autor Beitrag
anno2007
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win 7, Ubuntu
Delphi XE
BeitragVerfasst: So 29.03.09 21:22 
Hi,
ich brauche wieder eure Hilfe :S.

Ich habe jetzt eine MainForm erstellt, in der eig. alles drin ist.
Jetzt will ich noch eine kleine Form erstellen, die erscheint und erst beim Buttonclick soll die MainForm aufgerufen werden.
Mein Problem liegt Hauptsächlich darin die erstellte GUI am Anfang aufzurufen, bzw. die MainForm zu verstecken.

Danke für die Tips :).

anno2007
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: So 29.03.09 21:25 
Einfach im Objektinspektor dein Mainform.Visble auf False stellen und bei deinem kleinen Form auf True. Dann im Buttonclick-Ereignis

ausblenden Delphi-Quelltext
1:
2:
3:
4:
begin
  Mainform.Show;
  Kleinform.Hide;
end;
anno2007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win 7, Ubuntu
Delphi XE
BeitragVerfasst: So 29.03.09 21:32 
Danke für die Antwort.
Das hab ich eben schon probiert, aber das funktioniert so leider nicht.
Die kleine GUI wird zwar angezeigt, aber die wird MainForm trotz Visible = False angezeigt.
Wo könnte das dran liegen?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 29.03.09 21:40 
Schreib das doch einfach in den Projektquelltext (Projekt --> Quelltext anzeigen), wobei frmSplashScreen dein Startfensterchen ist:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {frmSplashScreen};

{$R *.res}

begin
  frmSplashScreen := TfrmSplashScreen.Create(nil);
  frmSplashScreen.ShowModal;
  frmSplashScreen.Free;


  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
Du kannst auch den Rückgabewert von ShowModal auswerten, wenn mit verschiedenen Buttons verschiedene Aktionen ausgelöst werden sollen. Die Buttons müssten dann ModalResult setzen.
anno2007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win 7, Ubuntu
Delphi XE
BeitragVerfasst: So 29.03.09 22:08 
Das ist schonmal perfekt, das richtige Fenster startet :) .
Aber wie zeige ich jetzt bei dem ButtonClick die MainForm wieder an?
Wie werte ich den Rückgabewert von ShowModal aus?

Dankeschön 8)
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: So 29.03.09 22:59 
user profile iconanno2007 hat folgendes geschrieben Zum zitierten Posting springen:
Aber wie zeige ich jetzt bei dem ButtonClick die MainForm wieder an?

Du brauchst das Formular nur zu schließen (Close;), dann geht's weiter im Code und das Hauptformular wird angezeigt.

user profile iconanno2007 hat folgendes geschrieben Zum zitierten Posting springen:
Wie werte ich den Rückgabewert von ShowModal aus?

Auswerten kannst du ihn wie folgt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
case frmSplashScreen.ShowModal of
  mrAbort: Halt;
  mrOk: { ... }
end;
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: So 29.03.09 23:07 
user profile iconYogu hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
case frmSplashScreen.ShowModal of
  mrAbort: Halt;
  mrOk: { ... }
end;
Aber das is nich dein Ernst, dass du [zitat Luckie] dein Auto zum Bremsen vor nen Baum fährst, anstatt die Bremse zu ziehen[sinngemäß]? :mrgreen:
Halt bitte nicht einsetzen. Wie gesagt. Auto gegen nen Baum fahren und so. Besser wäre natürlich:
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:
24:
25:
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {frmSplashScreen};

{$R *.res}

var SplashResult: Integer;

begin
  frmSplashScreen := TfrmSplashScreen.Create(nil);
  
  SplashResult := frmSplashScreen.ShowModal;

  frmSplashScreen.Free;

  if SplashResult = mrOK then
  begin
    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
    Application.Run;
  end{else, falls im Fehlerfall noch etwas passieren soll}
end.

Das heißt in dem Fall natürlich: Nur wenn meine Splash-Form mrOK liefert wird mein Programm ganz normal ausgeführt, an sonsten passiert nichts bzw. der Else-Zweig.
Wenn du einfach im Hauptfenster auswerten willst, was passiert ist, dann müsstest du irgendwie dem Hauptfenster die Variable SplashResult zukommen lassen, weiß jetzt nicht genau, wie.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: So 29.03.09 23:29 
Meine Güte, anno2007 wollte ein Beispiel, wie man den Rückgabewert auswertet. Wenn es dich beruhigt, schreibe ich halt noch was drüber:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
type EFaltalException = class(Exception)

procedure Halt;
begin
  raise EFatalException.Create('Evil developer tried to shutdown this '+
    'application very bad. To keep your safety, it will do it in a '+
    'different way.');
end;

:mrgreen:
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 30.03.09 00:04 
user profile iconYogu hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
2:
3:
raise EFatalException.Create('Evil developer tried to shutdown this '+
    'application very badly. To keep your safety, it will do it in a '+
    'different way.');
Wobei das mehr sowas heißt wie "hätte es verdammt gern getan", "gab sein bestes". Besser wäre "tried to shut [it] down in a very bad way" :mrgreen:

Aber genug :rofl:

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Mo 30.03.09 10:33 
Ich wusste ja schon immer, dass ich kein Englisch kann. :bawling:

(aber jetzt war's wirklich genug offtopic...)
anno2007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win 7, Ubuntu
Delphi XE
BeitragVerfasst: Mo 30.03.09 17:40 
Danke,
funzt jetzt perfekt :wink:

anno2007