Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi procedure nach Application.run (https://www.delphipraxis.net/140390-procedure-nach-application-run.html)

nahpets 17. Sep 2009 14:14

Re: procedure nach Application.run
 
Hallo,
Zitat:

Zitat von himitsu
Du kannst z.B. auch das Nebenformular zum Hauptformular machen.

jo, dat jeht ;-)
Delphi-Quellcode:
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Hauptformular},
  Unit2 in 'Unit2.pas' {Nebenformular};

{$R *.res}

begin
  Application.Initialize;
  If ParamStr(1) = 'open' then begin
    Application.CreateForm(TNebenformular, Nebenformular);
  end else begin
    Application.CreateForm(THauptformular, Hauptformular);
  end;
  Application.Run;
end.
Damit hat das Programm wahlweise das Hauptformular oder das Nebenformular als MainForm. Wenn ich die Fragestellung recht verstanden habe, ist genau das gewünscht. Wenn der erste Parameter = open, dann ist das Nebenformular anzuzeigen und das Hauptformular zu verstecken, andernfalls ist das Hauptformular als MainForm zu nutzen und das Nebenformular zu verstecken. Verstecken ist hier gleichbedeutend mit: "Wird nicht benötigt" und daher in diesem Beispiel auch nicht erstellt.

Bomberbb 17. Sep 2009 15:16

Re: procedure nach Application.run
 
Ja, versucht habe ich das
Delphi-Quellcode:
begin
  Application.Initialize;
  If ParamStr(1) = 'open' then begin
    Application.CreateForm(TNebenformular, Nebenformular);
  end else begin
    Application.CreateForm(THauptformular, Hauptformular);
  end;
  Application.Run;
end.
auch schon, aber sobald ich mit 'if' arbeite kommt die Meldung:
'Der Aufruf von Application.CreateForm fehlt oder ist nicht korrekt!'
Evtl. liegt das ja auch an meiner Delphiversion (D5).

nahpets 17. Sep 2009 15:21

Re: procedure nach Application.run
 
Zitat:

Zitat von Bomberbb
auch schon, aber sobald ich mit 'if' arbeite kommt die Meldung:
'Der Aufruf von Application.CreateForm fehlt oder ist nicht korrekt!'
Evtl. liegt das ja auch an meiner Delphiversion (D5).

Mit D7 hab' ich das kompiliert bekommen und das Programm läuft auch wie gewünscht. Momentan hab' ich da keine andere Idee, wie Du das Problem lösen könntest.


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:19 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz